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 2004/09/13 12:05:28 UTC
svn commit: rev 45962 - in incubator/lenya/trunk/src/test/org/apache/lenya/cms: authoring publication publication/file task
Author: andreas
Date: Mon Sep 13 03:05:28 2004
New Revision: 45962
Modified:
incubator/lenya/trunk/src/test/org/apache/lenya/cms/authoring/DocumentCreatorTest.java
incubator/lenya/trunk/src/test/org/apache/lenya/cms/publication/DefaultSiteTreeTest.java
incubator/lenya/trunk/src/test/org/apache/lenya/cms/publication/SiteTreeNodeImplTest.java
incubator/lenya/trunk/src/test/org/apache/lenya/cms/publication/file/FilePublicationTest.java
incubator/lenya/trunk/src/test/org/apache/lenya/cms/task/DocumentCopyTaskTest.java
incubator/lenya/trunk/src/test/org/apache/lenya/cms/task/DocumentDeactivateTaskTest.java
incubator/lenya/trunk/src/test/org/apache/lenya/cms/task/DocumentMoveTaskTest.java
incubator/lenya/trunk/src/test/org/apache/lenya/cms/task/DocumentRenameTaskTest.java
Log:
moved sitetree classes to their own package
Modified: incubator/lenya/trunk/src/test/org/apache/lenya/cms/authoring/DocumentCreatorTest.java
==============================================================================
--- incubator/lenya/trunk/src/test/org/apache/lenya/cms/authoring/DocumentCreatorTest.java (original)
+++ incubator/lenya/trunk/src/test/org/apache/lenya/cms/authoring/DocumentCreatorTest.java Mon Sep 13 03:05:28 2004
@@ -15,7 +15,7 @@
*
*/
-/* $Id: DocumentCreatorTest.java,v 1.8 2004/03/04 15:41:09 egli Exp $ */
+/* $Id$ */
package org.apache.lenya.cms.authoring;
@@ -28,9 +28,9 @@
import org.apache.lenya.cms.PublicationHelper;
import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.SiteTree;
-import org.apache.lenya.cms.publication.SiteTreeException;
-import org.apache.lenya.cms.publication.SiteTreeNode;
+import org.apache.lenya.cms.site.SiteException;
+import org.apache.lenya.cms.site.tree.SiteTree;
+import org.apache.lenya.cms.site.tree.SiteTreeNode;
/**
@@ -69,10 +69,10 @@
/**
* Tests whatever you want.
* @throws CreatorException when something went wrong.
- * @throws SiteTreeException when something went wrong.
+ * @throws SiteException when something went wrong.
*/
public void testCreator()
- throws CreatorException, SiteTreeException {
+ throws CreatorException, SiteException {
Publication publication = PublicationHelper.getPublication();
DocumentCreator creator = new DocumentCreator();
File authoringDirectory = new File(publication.getDirectory(), AUTHORING_DIR);
Modified: incubator/lenya/trunk/src/test/org/apache/lenya/cms/publication/DefaultSiteTreeTest.java
==============================================================================
--- incubator/lenya/trunk/src/test/org/apache/lenya/cms/publication/DefaultSiteTreeTest.java (original)
+++ incubator/lenya/trunk/src/test/org/apache/lenya/cms/publication/DefaultSiteTreeTest.java Mon Sep 13 03:05:28 2004
@@ -1,283 +1,288 @@
-/*
- * Copyright 1999-2004 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.
- *
- */
-
-/* $Id: DefaultSiteTreeTest.java,v 1.11 2004/03/04 15:41:09 egli Exp $ */
-
-package org.apache.lenya.cms.publication;
-
-import java.io.IOException;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerException;
-
-import junit.framework.TestCase;
-
-import org.xml.sax.SAXException;
-
-public class DefaultSiteTreeTest extends TestCase {
-
- private DefaultSiteTree siteTree = null;
-
- /**
- * Constructor.
- * @param test The test.
- */
- public DefaultSiteTreeTest(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) {
- junit.textui.TestRunner.run(DefaultSiteTreeTest.class);
- }
-
- /**
- * @see TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- siteTree = new DefaultSiteTree("testTree.xml");
- Label label = new Label("Foo", "en");
- Label[] fooLabels = { label };
- siteTree.addNode("/foo", fooLabels, null, null, false);
- label = new Label("Home", "en");
- Label[] homeLabels = { label };
- siteTree.addNode("/index", homeLabels, null, null, false);
- label = new Label("Bar", "en");
- Label label_de = new Label("Stab", "de");
- Label[] barLabels = { label, label_de };
- siteTree.addNode("/foo/bar", barLabels, "http://exact.biz", "suffix", true);
- label = new Label("Lala", "en");
- Label[] lalaLabels = { label };
- siteTree.addNode("/foo/lala", lalaLabels, null, null, false);
- }
-
- /**
- * @see TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- /**
- * Test for void DefaultSiteTree(String)
- */
- final public void testDefaultSiteTreeString() {
- //TODO Implement DefaultSiteTree().
- }
-
- /**
- * Test for void DefaultSiteTree(File)
- */
- final public void testDefaultSiteTreeFile() {
- //TODO Implement DefaultSiteTree().
- }
-
- /**
- * Test for void addNode(String, String, Label[])
- *
- * @throws SiteTreeException if an error occurs
- */
- final public void testAddNodeStringStringLabelArray() throws SiteTreeException {
- Label label = new Label("Tutorial", null);
- Label[] labels = { label };
-
- siteTree.addNode("/foo", "tutorial", labels);
- SiteTreeNode node = siteTree.getNode("/foo/tutorial");
- assertNotNull(node);
- assertEquals(node.getId(), "tutorial");
- }
-
- /**
- * Test for void addNode(SiteTreeNode)
- */
- final public void testAddNodeSiteTreeNode() {
- //TODO Implement addNode().
- }
-
- /**
- * Test for void addNode(String, Label[], String, String, boolean)
- *
- * @throws SiteTreeException if an error occurs
- */
- final public void testAddNodeStringLabelArrayStringStringboolean() throws SiteTreeException {
- Label label1 = new Label("Doh", "en");
- Label label2 = new Label("Ding", "en");
- Label[] labels = { label1, label2};
-
- siteTree.addNode("/foo/ding", labels, null, null, false);
-
- assertNotNull(siteTree.getNode("/foo/ding"));
- assertEquals(siteTree.getNode("/foo/ding").getId(), "ding");
- }
-
- /**
- * Test for void addNode(String, String, Label[], String, String, boolean)
- *
- * @throws SiteTreeException if an error occurs
- */
- final public void testAddNodeStringStringLabelArrayStringStringboolean() throws SiteTreeException {
- Label label1 = new Label("Doh", "en");
- Label label2 = new Label("Ding", "en");
- Label[] labels = { label1, label2};
-
- siteTree.addNode("/foo", "baz", labels, null, null, false);
-
- assertNotNull(siteTree.getNode("/foo/baz"));
- assertEquals(siteTree.getNode("/foo/baz").getId(), "baz");
- }
-
- /**
- * Test addLabel
- *
- * @throws SiteTreeException if an error occurs
- */
- final public void testAddLabel() throws SiteTreeException {
- Label label = new Label("Tutorial", null);
- Label[] labels = null;
-
- siteTree.addLabel("/foo/bar", label);
- labels = siteTree.getNode("/foo/bar").getLabels();
- assertEquals(labels.length, 3);
- label = siteTree.getNode("/foo/bar").getLabel("");
- assertNotNull(label);
- assertEquals(label.getLabel(), "Tutorial");
- }
-
- /**
- * Test removeLabel
- *
- */
- final public void testRemoveLabel() {
- assertEquals(siteTree.getNode("/foo/bar").getLabels().length, 2);
-
- Label label = new Label("Stab", "de");
- siteTree.removeLabel("/foo/bar", label);
- assertEquals(siteTree.getNode("/foo/bar").getLabels().length, 1);
-
- assertEquals(siteTree.getNode("/foo/bar").getLabels()[0], new Label("Bar", "en"));
-
- siteTree.addLabel("/foo/bar", label);
- assertEquals(siteTree.getNode("/foo/bar").getLabels().length, 2);
- }
-
- /**
- * Test removeNode
- *
- * @throws SiteTreeException if an error occurs
- */
- final public void testRemoveNode() throws SiteTreeException {
- Label label1 = new Label("Hi", "en");
- Label label2 = new Label("Ho", "en");
- Label[] labels1 = { label1, label2};
-
- siteTree.addNode("/hi", labels1, null, null, false);
-
- Label[] labels2 = { label1, label2};
-
- siteTree.addNode("/hi/ho", labels2, null, null, false);
-
- assertNotNull(siteTree.getNode("/hi/ho"));
-
- siteTree.removeNode("/hi");
-
- assertNull(siteTree.getNode("/hi/ho"));
- assertNull(siteTree.getNode("/hi"));
- }
-
- /**
- * Test getNode
- *
- */
- final public void testGetNode() {
- assertNotNull(siteTree.getNode("/foo/bar"));
-
- assertNull(siteTree.getNode("/foo/baz"));
- }
-
- /**
- * Test save
- *
- */
- final public void testSave() {
- //TODO Implement save().
- }
-
- /**
- * Test moving a node up
- *
- * @throws SiteTreeException if an error occurs
- * @throws IOException if an error occurs
- * @throws TransformerException if an error occurs
- */
- final public void testMoveUp() throws SiteTreeException, IOException, TransformerException {
- siteTree.moveUp("/foo/lala");
- siteTree.save();
- assertNotNull(siteTree.getNode("/foo/lala"));
- }
-
- /**
- * Test moving a node down
- *
- * @throws SiteTreeException if an error occurs
- * @throws IOException if an error occurs
- * @throws TransformerException if an error occurs
- */
- final public void testMoveDown() throws SiteTreeException, IOException, TransformerException {
- siteTree.moveDown("/foo");
- siteTree.save();
- assertNotNull(siteTree.getNode("/foo"));
- }
-
- /**
- * Test the import of a subtree
- *
- * @throws ParserConfigurationException if an error occurs.
- * @throws SAXException if an error occurs.
- * @throws SiteTreeException if an error occurs.
- * @throws IOException if an error occurs.
- * @throws TransformerException if an error occurs.
- */
- final public void testImportSubtree() throws ParserConfigurationException, SAXException, SiteTreeException, IOException, TransformerException {
- DefaultSiteTree newSiteTree = new DefaultSiteTree("importedTree.xml");
- Label label = new Label("root", "en");
- Label[] rootLabels = { label };
- newSiteTree.addNode("/root", rootLabels, null, null, false);
- label = new Label("foo", "en");
- Label[] fooLabels = { label };
- newSiteTree.addNode("/root/foo", fooLabels, null, null, false);
- label = new Label("subtree", "en");
- Label[] subtreeLabels = { label };
- newSiteTree.addNode("/root/subtree", subtreeLabels, "http://exact.biz", "suffix", true);
- label = new Label("child", "en");
- Label[] childLabels = { label };
- newSiteTree.addNode("/root/subtree/child", childLabels, null, null, false);
- SiteTreeNode node=newSiteTree.getNode("/root/subtree");
- assertNotNull(node);
- SiteTreeNode parentNode=siteTree.getNode("/foo/lala");
- assertNotNull(parentNode);
- siteTree.importSubtree(parentNode,node, "subtree", null);
- siteTree.save();
- assertNotNull(siteTree.getNode("/foo/lala/subtree"));
- assertNotNull(siteTree.getNode("/foo/lala/subtree/child"));
- }
-}
+/*
+ * Copyright 1999-2004 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.
+ *
+ */
+
+/* $Id$ */
+
+package org.apache.lenya.cms.publication;
+
+import java.io.IOException;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerException;
+
+import junit.framework.TestCase;
+
+import org.apache.lenya.cms.site.SiteException;
+import org.apache.lenya.cms.site.tree.DefaultSiteTree;
+import org.apache.lenya.cms.site.tree.Label;
+import org.apache.lenya.cms.site.tree.SiteTreeNode;
+import org.xml.sax.SAXException;
+
+public class DefaultSiteTreeTest extends TestCase {
+
+ private DefaultSiteTree siteTree = null;
+
+ /**
+ * Constructor.
+ * @param test The test.
+ */
+ public DefaultSiteTreeTest(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) {
+ junit.textui.TestRunner.run(DefaultSiteTreeTest.class);
+ }
+
+ /**
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ siteTree = new DefaultSiteTree("testTree.xml");
+ Label label = new Label("Foo", "en");
+ Label[] fooLabels = { label };
+ siteTree.addNode("/foo", fooLabels, null, null, false);
+ label = new Label("Home", "en");
+ Label[] homeLabels = { label };
+ siteTree.addNode("/index", homeLabels, null, null, false);
+ label = new Label("Bar", "en");
+ Label label_de = new Label("Stab", "de");
+ Label[] barLabels = { label, label_de };
+ siteTree.addNode("/foo/bar", barLabels, "http://exact.biz", "suffix", true);
+ label = new Label("Lala", "en");
+ Label[] lalaLabels = { label };
+ siteTree.addNode("/foo/lala", lalaLabels, null, null, false);
+ }
+
+ /**
+ * @see TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Test for void DefaultSiteTree(String)
+ */
+ final public void testDefaultSiteTreeString() {
+ //TODO Implement DefaultSiteTree().
+ }
+
+ /**
+ * Test for void DefaultSiteTree(File)
+ */
+ final public void testDefaultSiteTreeFile() {
+ //TODO Implement DefaultSiteTree().
+ }
+
+ /**
+ * Test for void addNode(String, String, Label[])
+ *
+ * @throws SiteException if an error occurs
+ */
+ final public void testAddNodeStringStringLabelArray() throws SiteException {
+ Label label = new Label("Tutorial", null);
+ Label[] labels = { label };
+
+ siteTree.addNode("/foo", "tutorial", labels);
+ SiteTreeNode node = siteTree.getNode("/foo/tutorial");
+ assertNotNull(node);
+ assertEquals(node.getId(), "tutorial");
+ }
+
+ /**
+ * Test for void addNode(SiteTreeNode)
+ */
+ final public void testAddNodeSiteTreeNode() {
+ //TODO Implement addNode().
+ }
+
+ /**
+ * Test for void addNode(String, Label[], String, String, boolean)
+ *
+ * @throws SiteException if an error occurs
+ */
+ final public void testAddNodeStringLabelArrayStringStringboolean() throws SiteException {
+ Label label1 = new Label("Doh", "en");
+ Label label2 = new Label("Ding", "en");
+ Label[] labels = { label1, label2};
+
+ siteTree.addNode("/foo/ding", labels, null, null, false);
+
+ assertNotNull(siteTree.getNode("/foo/ding"));
+ assertEquals(siteTree.getNode("/foo/ding").getId(), "ding");
+ }
+
+ /**
+ * Test for void addNode(String, String, Label[], String, String, boolean)
+ *
+ * @throws SiteException if an error occurs
+ */
+ final public void testAddNodeStringStringLabelArrayStringStringboolean() throws SiteException {
+ Label label1 = new Label("Doh", "en");
+ Label label2 = new Label("Ding", "en");
+ Label[] labels = { label1, label2};
+
+ siteTree.addNode("/foo", "baz", labels, null, null, false);
+
+ assertNotNull(siteTree.getNode("/foo/baz"));
+ assertEquals(siteTree.getNode("/foo/baz").getId(), "baz");
+ }
+
+ /**
+ * Test addLabel
+ *
+ * @throws SiteException if an error occurs
+ */
+ final public void testAddLabel() throws SiteException {
+ Label label = new Label("Tutorial", null);
+ Label[] labels = null;
+
+ siteTree.addLabel("/foo/bar", label);
+ labels = siteTree.getNode("/foo/bar").getLabels();
+ assertEquals(labels.length, 3);
+ label = siteTree.getNode("/foo/bar").getLabel("");
+ assertNotNull(label);
+ assertEquals(label.getLabel(), "Tutorial");
+ }
+
+ /**
+ * Test removeLabel
+ *
+ */
+ final public void testRemoveLabel() {
+ assertEquals(siteTree.getNode("/foo/bar").getLabels().length, 2);
+
+ Label label = new Label("Stab", "de");
+ siteTree.removeLabel("/foo/bar", label);
+ assertEquals(siteTree.getNode("/foo/bar").getLabels().length, 1);
+
+ assertEquals(siteTree.getNode("/foo/bar").getLabels()[0], new Label("Bar", "en"));
+
+ siteTree.addLabel("/foo/bar", label);
+ assertEquals(siteTree.getNode("/foo/bar").getLabels().length, 2);
+ }
+
+ /**
+ * Test removeNode
+ *
+ * @throws SiteException if an error occurs
+ */
+ final public void testRemoveNode() throws SiteException {
+ Label label1 = new Label("Hi", "en");
+ Label label2 = new Label("Ho", "en");
+ Label[] labels1 = { label1, label2};
+
+ siteTree.addNode("/hi", labels1, null, null, false);
+
+ Label[] labels2 = { label1, label2};
+
+ siteTree.addNode("/hi/ho", labels2, null, null, false);
+
+ assertNotNull(siteTree.getNode("/hi/ho"));
+
+ siteTree.removeNode("/hi");
+
+ assertNull(siteTree.getNode("/hi/ho"));
+ assertNull(siteTree.getNode("/hi"));
+ }
+
+ /**
+ * Test getNode
+ *
+ */
+ final public void testGetNode() {
+ assertNotNull(siteTree.getNode("/foo/bar"));
+
+ assertNull(siteTree.getNode("/foo/baz"));
+ }
+
+ /**
+ * Test save
+ *
+ */
+ final public void testSave() {
+ //TODO Implement save().
+ }
+
+ /**
+ * Test moving a node up
+ *
+ * @throws SiteException if an error occurs
+ * @throws IOException if an error occurs
+ * @throws TransformerException if an error occurs
+ */
+ final public void testMoveUp() throws SiteException, IOException, TransformerException {
+ siteTree.moveUp("/foo/lala");
+ siteTree.save();
+ assertNotNull(siteTree.getNode("/foo/lala"));
+ }
+
+ /**
+ * Test moving a node down
+ *
+ * @throws SiteException if an error occurs
+ * @throws IOException if an error occurs
+ * @throws TransformerException if an error occurs
+ */
+ final public void testMoveDown() throws SiteException, IOException, TransformerException {
+ siteTree.moveDown("/foo");
+ siteTree.save();
+ assertNotNull(siteTree.getNode("/foo"));
+ }
+
+ /**
+ * Test the import of a subtree
+ *
+ * @throws ParserConfigurationException if an error occurs.
+ * @throws SAXException if an error occurs.
+ * @throws SiteException if an error occurs.
+ * @throws IOException if an error occurs.
+ * @throws TransformerException if an error occurs.
+ */
+ final public void testImportSubtree() throws ParserConfigurationException, SAXException,
+ SiteException, IOException, TransformerException {
+ DefaultSiteTree newSiteTree = new DefaultSiteTree("importedTree.xml");
+ Label label = new Label("root", "en");
+ Label[] rootLabels = { label };
+ newSiteTree.addNode("/root", rootLabels, null, null, false);
+ label = new Label("foo", "en");
+ Label[] fooLabels = { label };
+ newSiteTree.addNode("/root/foo", fooLabels, null, null, false);
+ label = new Label("subtree", "en");
+ Label[] subtreeLabels = { label };
+ newSiteTree.addNode("/root/subtree", subtreeLabels, "http://exact.biz", "suffix", true);
+ label = new Label("child", "en");
+ Label[] childLabels = { label };
+ newSiteTree.addNode("/root/subtree/child", childLabels, null, null, false);
+ SiteTreeNode node=newSiteTree.getNode("/root/subtree");
+ assertNotNull(node);
+ SiteTreeNode parentNode=siteTree.getNode("/foo/lala");
+ assertNotNull(parentNode);
+ siteTree.importSubtree(parentNode,node, "subtree", null);
+ siteTree.save();
+ assertNotNull(siteTree.getNode("/foo/lala/subtree"));
+ assertNotNull(siteTree.getNode("/foo/lala/subtree/child"));
+ }
+}
Modified: incubator/lenya/trunk/src/test/org/apache/lenya/cms/publication/SiteTreeNodeImplTest.java
==============================================================================
--- incubator/lenya/trunk/src/test/org/apache/lenya/cms/publication/SiteTreeNodeImplTest.java (original)
+++ incubator/lenya/trunk/src/test/org/apache/lenya/cms/publication/SiteTreeNodeImplTest.java Mon Sep 13 03:05:28 2004
@@ -15,9 +15,13 @@
*
*/
-/* $Id: SiteTreeNodeImplTest.java,v 1.4 2004/03/04 15:41:09 egli Exp $ */
+/* $Id$ */
package org.apache.lenya.cms.publication;
+
+import org.apache.lenya.cms.site.tree.DefaultSiteTree;
+import org.apache.lenya.cms.site.tree.Label;
+import org.apache.lenya.cms.site.tree.SiteTreeNode;
import junit.framework.TestCase;
Modified: incubator/lenya/trunk/src/test/org/apache/lenya/cms/publication/file/FilePublicationTest.java
==============================================================================
--- incubator/lenya/trunk/src/test/org/apache/lenya/cms/publication/file/FilePublicationTest.java (original)
+++ incubator/lenya/trunk/src/test/org/apache/lenya/cms/publication/file/FilePublicationTest.java Mon Sep 13 03:05:28 2004
@@ -15,7 +15,7 @@
*
*/
-/* $Id: FilePublicationTest.java,v 1.4 2004/03/04 15:41:10 egli Exp $ */
+/* $Id$ */
package org.apache.lenya.cms.publication.file;
@@ -28,12 +28,12 @@
import org.apache.lenya.cms.publication.Document;
import org.apache.lenya.cms.publication.DocumentBuilder;
import org.apache.lenya.cms.publication.DocumentException;
-import org.apache.lenya.cms.publication.Label;
import org.apache.lenya.cms.publication.Publication;
import org.apache.lenya.cms.publication.PublicationException;
-import org.apache.lenya.cms.publication.SiteTree;
-import org.apache.lenya.cms.publication.SiteTreeException;
-import org.apache.lenya.cms.publication.SiteTreeNode;
+import org.apache.lenya.cms.site.SiteException;
+import org.apache.lenya.cms.site.tree.Label;
+import org.apache.lenya.cms.site.tree.SiteTree;
+import org.apache.lenya.cms.site.tree.SiteTreeNode;
/**
* To change the template for this generated type comment go to
@@ -50,9 +50,8 @@
}
/**
- * The main program.
- * The parameters are set from the command line arguments.
- *
+ * The main program. The parameters are set from the command line arguments.
+ *
* @param args The command line arguments.
*/
public static void main(String[] args) {
@@ -74,24 +73,14 @@
public static final String destinationLanguage = "en";
/**
- * Tests copying a document.
+ * Tests copying a document.
* @throws PublicationException when something went wrong.
*/
- public void testCopyDocument() throws PublicationException, DocumentException, SiteTreeException {
- testCopyDocument(
- Publication.AUTHORING_AREA,
- sourceDocumentId,
- sourceLanguage,
- Publication.AUTHORING_AREA,
- destinationDocumentId,
- destinationLanguage);
- testCopyDocument(
- Publication.AUTHORING_AREA,
- sourceDocumentId,
- sourceLanguage,
- Publication.LIVE_AREA,
- sourceDocumentId,
- sourceLanguage);
+ 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);
}
/**
@@ -104,15 +93,10 @@
* @param destinationLanguage The destination language.
* @throws PublicationException when something went wrong.
*/
- public void testCopyDocument(
- String sourceArea,
- String sourceDocumentId,
- String sourceLanguage,
- String destinationArea,
- String destinationDocumentId,
- String destinationLanguage)
- throws PublicationException, DocumentException, SiteTreeException {
-
+ 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 + "]");
System.out.println(" Source document ID: [" + sourceDocumentId + "]");
@@ -120,35 +104,31 @@
System.out.println(" Destination area: [" + destinationArea + "]");
System.out.println(" Destination document ID: [" + destinationDocumentId + "]");
System.out.println(" Destination language: [" + destinationLanguage + "]");
-
+
Publication publication = PublicationHelper.getPublication();
DocumentBuilder builder = publication.getDocumentBuilder();
-
- String sourceUrl =
- builder.buildCanonicalUrl(publication, sourceArea, sourceDocumentId, sourceLanguage);
+
+ String sourceUrl = builder.buildCanonicalUrl(publication, sourceArea, sourceDocumentId,
+ sourceLanguage);
Document sourceDocument = builder.buildDocument(publication, sourceUrl);
- String destinationUrl =
- builder.buildCanonicalUrl(
- publication,
- destinationArea,
- destinationDocumentId,
- destinationLanguage);
+ String destinationUrl = builder.buildCanonicalUrl(publication, destinationArea,
+ destinationDocumentId, destinationLanguage);
Document destinationDocument = builder.buildDocument(publication, destinationUrl);
-
+
publication.copyDocument(sourceDocument, destinationDocument);
-
+
assertTrue(destinationDocument.exists());
-
+
SiteTree destinationTree = publication.getSiteTree(destinationArea);
SiteTreeNode destinationNode = destinationTree.getNode(destinationDocumentId);
assertNotNull(destinationNode);
Label destinationLabel = destinationNode.getLabel(destinationLanguage);
assertNotNull(destinationLabel);
-
+
SiteTreeNode sourceNode = destinationTree.getNode(sourceDocumentId);
Label sourceLabel = sourceNode.getLabel(sourceLanguage);
-
+
assertTrue(destinationLabel.getLabel().equals(sourceLabel.getLabel()));
-
+
}
-}
+}
\ No newline at end of file
Modified: incubator/lenya/trunk/src/test/org/apache/lenya/cms/task/DocumentCopyTaskTest.java
==============================================================================
--- incubator/lenya/trunk/src/test/org/apache/lenya/cms/task/DocumentCopyTaskTest.java (original)
+++ incubator/lenya/trunk/src/test/org/apache/lenya/cms/task/DocumentCopyTaskTest.java Mon Sep 13 03:05:28 2004
@@ -15,7 +15,7 @@
*
*/
-/* $Id: DocumentCopyTaskTest.java,v 1.7 2004/03/04 15:41:10 egli Exp $ */
+/* $Id$ */
package org.apache.lenya.cms.task;
@@ -29,8 +29,8 @@
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.lenya.cms.PublicationHelper;
import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.SiteTree;
-import org.apache.lenya.cms.publication.SiteTreeNode;
+import org.apache.lenya.cms.site.tree.SiteTree;
+import org.apache.lenya.cms.site.tree.SiteTreeNode;
/**
Modified: incubator/lenya/trunk/src/test/org/apache/lenya/cms/task/DocumentDeactivateTaskTest.java
==============================================================================
--- incubator/lenya/trunk/src/test/org/apache/lenya/cms/task/DocumentDeactivateTaskTest.java (original)
+++ incubator/lenya/trunk/src/test/org/apache/lenya/cms/task/DocumentDeactivateTaskTest.java Mon Sep 13 03:05:28 2004
@@ -15,7 +15,7 @@
*
*/
-/* $Id: DocumentDeactivateTaskTest.java,v 1.5 2004/03/20 11:46:20 gregor Exp $ */
+/* $Id$ */
package org.apache.lenya.cms.task;
@@ -28,8 +28,8 @@
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.lenya.cms.PublicationHelper;
import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.SiteTree;
-import org.apache.lenya.cms.publication.SiteTreeNode;
+import org.apache.lenya.cms.site.tree.SiteTree;
+import org.apache.lenya.cms.site.tree.SiteTreeNode;
/**
Modified: incubator/lenya/trunk/src/test/org/apache/lenya/cms/task/DocumentMoveTaskTest.java
==============================================================================
--- incubator/lenya/trunk/src/test/org/apache/lenya/cms/task/DocumentMoveTaskTest.java (original)
+++ incubator/lenya/trunk/src/test/org/apache/lenya/cms/task/DocumentMoveTaskTest.java Mon Sep 13 03:05:28 2004
@@ -15,7 +15,7 @@
*
*/
-/* $Id: DocumentMoveTaskTest.java,v 1.4 2004/03/20 11:46:20 gregor Exp $ */
+/* $Id$ */
package org.apache.lenya.cms.task;
@@ -29,9 +29,9 @@
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.lenya.cms.PublicationHelper;
import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.SiteTree;
-import org.apache.lenya.cms.publication.SiteTreeNode;
import org.apache.lenya.cms.rc.RevisionController;
+import org.apache.lenya.cms.site.tree.SiteTree;
+import org.apache.lenya.cms.site.tree.SiteTreeNode;
/**
Modified: incubator/lenya/trunk/src/test/org/apache/lenya/cms/task/DocumentRenameTaskTest.java
==============================================================================
--- incubator/lenya/trunk/src/test/org/apache/lenya/cms/task/DocumentRenameTaskTest.java (original)
+++ incubator/lenya/trunk/src/test/org/apache/lenya/cms/task/DocumentRenameTaskTest.java Mon Sep 13 03:05:28 2004
@@ -15,7 +15,7 @@
*
*/
-/* $Id: DocumentRenameTaskTest.java,v 1.6 2004/03/04 15:41:10 egli Exp $ */
+/* $Id$ */
package org.apache.lenya.cms.task;
@@ -29,9 +29,9 @@
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.lenya.cms.PublicationHelper;
import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.SiteTree;
-import org.apache.lenya.cms.publication.SiteTreeNode;
import org.apache.lenya.cms.rc.RevisionController;
+import org.apache.lenya.cms.site.tree.SiteTree;
+import org.apache.lenya.cms.site.tree.SiteTreeNode;
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org