Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

svn commit: r387516 - in /lenya/trunk/src: targets/test-build.xml test/org/: msg#00183

cms.lenya.cvs

Subject: svn commit: r387516 - in /lenya/trunk/src: targets/test-build.xml test/org/apache/lenya/cms/site/ test/org/apache/lenya/cms/site/usecases/ test/org/apache/lenya/cms/site/usecases/LinkRewriterTest.java test/org/apache/lenya/cms/site/usecases/index_en.xml

Author: andreas
Date: Tue Mar 21 04:59:36 2006
New Revision: 387516

URL: http://svn.apache.org/viewcvs?rev=387516&view=rev
Log:
Added LinkRewriterTest

Added:
lenya/trunk/src/test/org/apache/lenya/cms/site/
lenya/trunk/src/test/org/apache/lenya/cms/site/usecases/

lenya/trunk/src/test/org/apache/lenya/cms/site/usecases/LinkRewriterTest.java
lenya/trunk/src/test/org/apache/lenya/cms/site/usecases/index_en.xml
Modified:
lenya/trunk/src/targets/test-build.xml

Modified: lenya/trunk/src/targets/test-build.xml
URL:
http://svn.apache.org/viewcvs/lenya/trunk/src/targets/test-build.xml?rev=387516&r1=387515&r2=387516&view=diff
==============================================================================
--- lenya/trunk/src/targets/test-build.xml (original)
+++ lenya/trunk/src/targets/test-build.xml Tue Mar 21 04:59:36 2006
@@ -155,7 +155,9 @@

<!-- Runs JUnit tests -->
<target name="tests.junit" depends="tests.prepare, test.pub.prepare">
- <junit printsummary="yes" showoutput="true" haltonerror="on"
haltonfailure="on">
+ <junit printsummary="yes" showoutput="true" haltonerror="on"
haltonfailure="on" fork="true">
+ <jvmarg
value="-Djava.endorsed.dirs=${build.webapp}/WEB-INF/lib/endorsed"/>
+ <jvmarg
value="-Dorg.xml.sax.parser=org.apache.xerces.parsers.SAXParser"/>
<sysproperty key="junit.test.loglevel" value="${junit.test.loglevel}"/>
<sysproperty key="contextRoot" value="${basedir}/build/lenya/webapp"/>
<sysproperty key="tempDir" value="${basedir}/build/lenya/temp"/>
@@ -171,7 +173,7 @@
</fileset>
<pathelement path="${src.test.dir}"/>
</classpath>
-
+
<test name="org.apache.lenya.ac.impl.IdentityTest" todir="${junit.dir}"/>
<test name="org.apache.lenya.ac.impl.AccessControllerTest"
todir="${junit.dir}"/>
<test name="org.apache.lenya.ac.impl.AccreditableManagerTest"
todir="${junit.dir}"/>
@@ -198,7 +200,10 @@
<test name="org.apache.lenya.cms.rc.RCMLTest" todir="${junit.dir}"/>
<test name="org.apache.lenya.cms.rc.RevisionControllerTest"
todir="${junit.dir}"/>
-->
+
<test name="org.apache.lenya.cms.workflow.WorkflowTest"
todir="${junit.dir}"/>
+ <test name="org.apache.lenya.cms.site.usecases.LinkRewriterTest"
todir="${junit.dir}"/>
+
</junit>
</target>


Added:
lenya/trunk/src/test/org/apache/lenya/cms/site/usecases/LinkRewriterTest.java
URL:
http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/cms/site/usecases/LinkRewriterTest.java?rev=387516&view=auto
==============================================================================
---
lenya/trunk/src/test/org/apache/lenya/cms/site/usecases/LinkRewriterTest.java
(added)
+++
lenya/trunk/src/test/org/apache/lenya/cms/site/usecases/LinkRewriterTest.java
Tue Mar 21 04:59:36 2006
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ *
+ */
+package org.apache.lenya.cms.site.usecases;
+
+import org.apache.lenya.cms.cocoon.source.SourceUtil;
+import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.cms.publication.DocumentManager;
+import org.apache.lenya.cms.publication.Publication;
+import org.apache.lenya.cms.publication.PublicationUtil;
+import org.apache.lenya.cms.repository.RepositoryTestCase;
+import org.apache.lenya.cms.site.SiteUtil;
+import org.apache.lenya.xml.DocumentHelper;
+import org.apache.xpath.XPathAPI;
+import org.w3c.dom.Attr;
+import org.w3c.dom.NodeList;
+
+/**
+ * Link rewriter test.
+ */
+public class LinkRewriterTest extends RepositoryTestCase {
+
+ protected static final String DOCUMENT_ID = "/index";
+ protected static final String SOURCE_DOCUMENT_ID = "/concepts";
+ protected static final String TARGET_DOCUMENT_ID = "/copied";
+
+ /**
+ * Test method.
+ * @throws Exception
+ */
+ public void testLinkRewriter() throws Exception {
+
+ Publication pub = PublicationUtil.getPublication(getManager(), "test");
+
+ Document document = getIdentityMap().get(pub,
Publication.AUTHORING_AREA, DOCUMENT_ID, "en");
+ org.w3c.dom.Document xml =
DocumentHelper.readDocument(getClass().getResourceAsStream("index_en.xml"));
+ document.getRepositoryNode().lock();
+ SourceUtil.writeDOM(xml, document.getSourceURI(), getManager());
+
+ LinkRewriter rewriter = null;
+ DocumentManager docManager = null;
+ Document target = null;
+ try {
+ docManager = (DocumentManager)
getManager().lookup(DocumentManager.ROLE);
+
+ Document source = getIdentityMap().get(pub,
+ Publication.AUTHORING_AREA,
+ SOURCE_DOCUMENT_ID,
+ "en");
+ source.getRepositoryNode().lock();
+
+ target = getIdentityMap().get(pub, Publication.AUTHORING_AREA,
TARGET_DOCUMENT_ID, "en");
+ target.getRepositoryNode().lock();
+
+ SiteUtil.getSiteStructure(getManager(),
target).getRepositoryNode().lock();
+
+ docManager.move(source, target);
+
+ rewriter = (LinkRewriter) getManager().lookup(LinkRewriter.ROLE);
+ rewriter.rewriteLinks(source, target);
+
+ } finally {
+ if (docManager != null) {
+ getManager().release(docManager);
+ }
+ if (rewriter != null) {
+ getManager().release(rewriter);
+ }
+ }
+
+ String[] xPaths = document.getResourceType().getLinkAttributeXPaths();
+ assertTrue(xPaths.length > 0);
+
+ org.w3c.dom.Document xmlDoc =
SourceUtil.readDOM(document.getSourceURI(), getManager());
+ boolean matched = false;
+
+ for (int i = 0; i < xPaths.length; i++) {
+ NodeList nodes = XPathAPI.selectNodeList(xmlDoc, xPaths[i]);
+ for (int nodeIndex = 0; nodeIndex < nodes.getLength();
nodeIndex++) {
+ Attr attribute = (Attr) nodes.item(nodeIndex);
+ String targetUrl = attribute.getValue();
+ Document targetDoc = getIdentityMap().getFromURL(targetUrl);
+ if (targetDoc.equals(target)) {
+ matched = true;
+ }
+ }
+ }
+ assertTrue(matched);
+ }
+
+}

Added: lenya/trunk/src/test/org/apache/lenya/cms/site/usecases/index_en.xml
URL:
http://svn.apache.org/viewcvs/lenya/trunk/src/test/org/apache/lenya/cms/site/usecases/index_en.xml?rev=387516&view=auto
==============================================================================
--- lenya/trunk/src/test/org/apache/lenya/cms/site/usecases/index_en.xml (added)
+++ lenya/trunk/src/test/org/apache/lenya/cms/site/usecases/index_en.xml Tue
Mar 21 04:59:36 2006
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<html xmlns="http://www.w3.org/1999/xhtml";
+xmlns:xhtml="http://www.w3.org/1999/xhtml";
+xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0";>
+
+<!--
+ Copyright 1999-2005 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: index_en.xml 169299 2005-05-09 12:00:43Z jwkaltz $ -->
+ <head>
+ <title>Welcome to the Default publication</title>
+ </head>
+ <body>
+ <h1>Hello and welcome to the Lenya default publication!</h1>
+
+ <p>Apache Lenya is a Java Open-Source Content Management System
+ based on open standards such as XML and XSLT and the Apache
+ Software Stack, in particular the XML publishing framework Apache
+ Cocoon.</p>
+
+ <p>For an overview of the concepts and the terminology used in
+ Apache Lenya please see the <a
href="/test/authoring/concepts.html">Concepts
+ section</a>. To see what you can do with Apache Lenya please
+ refer to the <a href="/test/authoring/features.html">Features
+ section</a>.</p>
+
+ <p>If you'd like to get a quick introduction on how to use Apache
+ Lenya CMS please go through the <a
+ href="/test/authoring/tutorial.html">tutorial</a>.</p>
+
+ <p>The purpose of this publication is</p>
+
+ <ul>
+ <li>to show beginners the basic functionality of the Apache
+ Lenya CMS,</li>
+
+ <li>to provide an "out of the box" publication that can be
+ easily adapted and used,</li>
+
+ <li>and to provide a basis for reference implementations of new
+ concepts and best practices.</li>
+
+ </ul>
+
+ <p>This publication does not go to the limit of what's possible
+ with Apache Lenya CMS, there are no fancy bells and whistles to
+ confuse you, this publication simply contains everything you need
+ to get started.</p>
+ </body>
+</html>


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
hardware.arm.at...    cms.citadel.dev...    video.gstreamer...    java.facelets.u...    misc.basics.qna...    web.wiki.instik...    network.uip.use...    xdg.devel/2003-...    tex.bibtex.bibd...    finance.quotesp...    ietf.zeroconf/2...    redhat.blinux.g...    suse.db2/2003-0...    php.phpesp/2004...    uml.devel/2003-...    gnome.labyrinth...    qnx.openqnx.dev...    boot-loaders.gr...    db.dataperfect....    audio.audacity....    linux.uclinux.m...    editors.j.devel...    os.openbsd.tech...    kde.users.multi...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation