[Yanel-commits] rev 21584 - in public/yanel/trunk/src: realms/test/yanel realms/test/yanel/config realms/test/yanel/data realms/test/yanel/data/css realms/test/yanel/data/img realms/test/yanel/data/xslt realms/test/yanel/rti resources/testing-control/src/java/org/wyona/yanel/impl/resources resources/testing-control/xslt

josias at wyona.com josias at wyona.com
Wed Jan 10 11:51:35 CET 2007


Author: josias
Date: 2007-01-10 11:51:34 +0100 (Wed, 10 Jan 2007)
New Revision: 21584

Added:
   public/yanel/trunk/src/realms/test/yanel/data/css/
   public/yanel/trunk/src/realms/test/yanel/data/css/global.css
   public/yanel/trunk/src/realms/test/yanel/data/img/
   public/yanel/trunk/src/realms/test/yanel/data/img/yanel.gif
   public/yanel/trunk/src/realms/test/yanel/data/index.html
   public/yanel/trunk/src/realms/test/yanel/data/xslt/
   public/yanel/trunk/src/realms/test/yanel/data/xslt/global.xsl
   public/yanel/trunk/src/realms/test/yanel/rti/testing-times.html.yanel-rti
   public/yanel/trunk/src/resources/testing-control/src/java/org/wyona/yanel/impl/resources/ExecuteTests.java
   public/yanel/trunk/src/resources/testing-control/xslt/chooseTest.xsl
Removed:
   public/yanel/trunk/src/realms/test/yanel/data-paths/
   public/yanel/trunk/src/realms/test/yanel/data/index.xhtml
Modified:
   public/yanel/trunk/src/realms/test/yanel/config/data-repository.xml
   public/yanel/trunk/src/realms/test/yanel/rti/.yanel-rti
   public/yanel/trunk/src/realms/test/yanel/rti/testing-control.html.yanel-rti
   public/yanel/trunk/src/resources/testing-control/src/java/org/wyona/yanel/impl/resources/TestingControlResource.java
   public/yanel/trunk/src/resources/testing-control/xslt/copyOutput.xsl
   public/yanel/trunk/src/resources/testing-control/xslt/result2html.xsl
Log:
applied patch for bug #5113: improved testing realm and resource.

Modified: public/yanel/trunk/src/realms/test/yanel/config/data-repository.xml
===================================================================
--- public/yanel/trunk/src/realms/test/yanel/config/data-repository.xml	2007-01-10 08:56:44 UTC (rev 21583)
+++ public/yanel/trunk/src/realms/test/yanel/config/data-repository.xml	2007-01-10 10:51:34 UTC (rev 21584)
@@ -3,16 +3,10 @@
 <repository>
   <name>Test Data Repository</name>
 
-<!--
-  <paths class="org.wyona.yarep.impl.VFileSystemMapImpl" src="../../../../../local/test"/>
+  <paths class="org.wyona.yarep.impl.VFileSystemMapImpl" src="../../../../../local/test/data"/>
 
   <storage class="org.wyona.yarep.core.impl.vfs.VFileSystemStorage">
-    <content src="../../../../../local/test"/>
-  </storage>
--->
-  <paths src="../../../../../local/test/data-paths" fallback="true"/>
-
-  <storage class="org.wyona.yarep.core.impl.fs.FileSystemStorage">
     <content src="../../../../../local/test/data"/>
+    <directory alternative="index.html" mime-type="application/xhtml+xml"/>
   </storage>
 </repository>

Added: public/yanel/trunk/src/realms/test/yanel/data/css/global.css
===================================================================
--- public/yanel/trunk/src/realms/test/yanel/data/css/global.css	2007-01-10 08:56:44 UTC (rev 21583)
+++ public/yanel/trunk/src/realms/test/yanel/data/css/global.css	2007-01-10 10:51:34 UTC (rev 21584)
@@ -0,0 +1,99 @@
+body  {
+       background-color:#ffffff;
+       font-size:11px;
+       font-family:Verdana, Arial, SunSans-Regular, Sans-Serif;
+       color:#564b47;
+       padding:0px;
+       margin:0px;
+       text-align:center
+}
+
+
+#container  {
+       width:800px;
+       padding:0px;
+       margin:0px;
+       margin-left:auto;
+       margin-right:auto;
+       text-align:left
+}
+
+#header  {
+       text-align:left;
+       background-color:#ffffff;
+       padding-top:0px;
+       margin:10px 0px 0px 0px;
+       border-style:solid;
+       border-color:#d8dfea;
+       border-width:1px
+}
+
+#header img  {
+       padding:0px;
+       border:0px;
+       margin-top:0px;
+       margin-left:0px
+}
+
+#navigation  {
+       width:171px;
+       float:left;
+       position:relative;
+       margin-left:-171px;
+       margin-right:1px;
+       padding:5px
+}
+
+#content {
+       position:relative;
+       margin:0px;
+       padding:5px;
+       background-color:#ffffff;
+       border-style:solid;
+       border-color:#d8dfea;
+       border-width:1px
+}
+
+#outer {
+       /*navigation background-color*/
+       border-left:solid 171px #f7f7f7;
+       /*content background-color*/
+       background-color:#f7f7f7; padding:5px
+}
+
+#inner {
+  margin:0px;
+  width:100%
+}
+
+#footer  {
+       clear:left;
+       padding:10px;
+       margin:0px;
+       background-color:#f7f7f7;
+       text-align:left
+}
+
+h1  {
+  font-size:14px
+}
+
+a  {
+       color:#0066cc;
+       text-decoration:none
+}
+
+a:hover  {
+       text-decoration:underline;
+       color:#3366cc
+}
+
+a:visited  {
+       text-decoration:none;
+       color:#777777
+}
+
+a:visited:hover  {
+       text-decoration:underline;
+       color:#777777
+}


Property changes on: public/yanel/trunk/src/realms/test/yanel/data/css/global.css
___________________________________________________________________
Name: svn:eol-style
   + native

Added: public/yanel/trunk/src/realms/test/yanel/data/img/yanel.gif
===================================================================
(Binary files differ)


Property changes on: public/yanel/trunk/src/realms/test/yanel/data/img/yanel.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: public/yanel/trunk/src/realms/test/yanel/data/index.html
===================================================================
--- public/yanel/trunk/src/realms/test/yanel/data/index.html	2007-01-10 08:56:44 UTC (rev 21583)
+++ public/yanel/trunk/src/realms/test/yanel/data/index.html	2007-01-10 10:51:34 UTC (rev 21584)
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+  <title>Tests</title>
+</head>
+<body>
+<h1>Tests</h1>
+<p>
+Here you can execute the Junit and HTMLunit tests that comes with yanel to
+test your yanel.
+</p>
+<p>
+<a href="testing-control.html">Testing Control</a>
+</p>
+</body>
+</html>


Property changes on: public/yanel/trunk/src/realms/test/yanel/data/index.html
___________________________________________________________________
Name: svn:eol-style
   + native

Deleted: public/yanel/trunk/src/realms/test/yanel/data/index.xhtml
===================================================================
--- public/yanel/trunk/src/realms/test/yanel/data/index.xhtml	2007-01-10 08:56:44 UTC (rev 21583)
+++ public/yanel/trunk/src/realms/test/yanel/data/index.xhtml	2007-01-10 10:51:34 UTC (rev 21584)
@@ -1,15 +0,0 @@
-<?xml version="1.0"?>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-  <title>Tests</title>
-</head>
-<body>
-<h1>Tests</h1>
-<p>
-<a href="testing-control.html">Testing Control</a>
-</p>
-</body>
-</html>

Added: public/yanel/trunk/src/realms/test/yanel/data/xslt/global.xsl
===================================================================
--- public/yanel/trunk/src/realms/test/yanel/data/xslt/global.xsl	2007-01-10 08:56:44 UTC (rev 21583)
+++ public/yanel/trunk/src/realms/test/yanel/data/xslt/global.xsl	2007-01-10 10:51:34 UTC (rev 21584)
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:xhtml="http://www.w3.org/1999/xhtml"
+  xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+  xmlns="http://www.w3.org/1999/xhtml">
+
+  <!-- IMPORTANT: Needs to correspond to the mime-type which is sent by the server! -->
+  <xsl:output method="xhtml" encoding="UTF-8"/>
+
+  <xsl:param name="yanel.path.name" select="'NAME_IS_NULL'"/>
+  <xsl:param name="yanel.path" select="'PATH_IS_NULL'"/>
+  <xsl:param name="yanel.back2context" select="'BACK2CONTEXT_IS_NULL'"/>
+  <xsl:param name="yarep.back2realm" select="'BACK2REALM_IS_NULL'"/>
+  <xsl:param name="yanel.meta.language" select="'en'"/>
+
+  <xsl:variable name="name-without-suffix" select="substring-before($yanel.path.name, '.')"/>
+
+  <xsl:template match="/">
+    <html xmlns="http://www.w3.org/1999/xhtml">
+      <xsl:comment> WARNING: This content has been generated dynamically. All
+        changes will be lost.</xsl:comment>
+      <head>
+        <xsl:comment>Name: <xsl:value-of select="$yanel.path.name"/> (without
+          suffix: <xsl:value-of select="$name-without-suffix"/>), Path:
+            <xsl:value-of select="$yanel.path"/>, Back 2 Realm: <xsl:value-of
+          select="$yarep.back2realm"/>, Back 2 Context: <xsl:value-of select="$yanel.back2context"/>
+        </xsl:comment>
+        <title>
+          <xsl:value-of select="/xhtml:html/xhtml:head/xhtml:title"/> - Yanel</title>
+        <!-- This is needed such that Microsoft Internet Explorer displays characters such as &nbsp; correctly (also see xsl:output, whereas I (Michi) am not sure if the encoding is really needed there) -->
+        <meta content="application/xhtml+xml; charset=UTF-8" http-equiv="Content-Type"/>
+        <meta name="generator" content="Wyona Yanel"/>
+        <!-- http://dublincore.org/documents/2001/04/12/usageguide/simple-html.shtml -->
+        <meta name="DC.Creator" content="TODO"/>
+        <meta name="DC.Language" content="TODO"/>
+        <link rel="stylesheet" href="{$yarep.back2realm}css/global.css" type="text/css"/>
+        <xsl:copy-of select="/xhtml:html/xhtml:head/*[name(.) != 'title']"/>
+        <xsl:choose>
+          <xsl:when test="/xhtml:html/xhtml:head/xhtml:link/@rel='neutron-introspection'">
+            <!-- NOTE: Use the one from the copy above in case one exists! -->
+          </xsl:when>
+          <xsl:otherwise>
+            <!-- TODO: Maybe one should better not cut-off the suffix! -->
+            <link rel="neutron-introspection" type="application/neutron+xml" href="introspection-{$name-without-suffix}.xml"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </head>
+      <body>
+        <div id="container">
+          <div id="header">
+            <a href="{$yarep.back2realm}index.html">
+              <img src="{$yarep.back2realm}img/yanel.gif"/>
+            </a>
+          </div>
+          <div id="outer">
+            <div id="inner">
+              <div id="navigation">
+                <xsl:call-template name="navigation"/>
+              </div>
+              <div id="content">
+                <div id="test">
+                  <xsl:copy-of select="/xhtml:html/xhtml:body/*"/>
+                </div>
+              </div>
+            </div>
+          </div>
+          <div id="footer">
+            <font size="-1">
+              <i18n:message key="poweredBy"/>
+              <a href="http://yanel.wyona.org">Wyona Yanel</a>, <a
+                href="https://svn.wyona.org/repos/public/tomcat-cluster/">Wyona
+              Balancer</a>, <a href="http://tomcat.apache.org">Apache
+              Tomcat</a>, <a href="http://httpd.apache.org">Apache HTTP Server</a>
+            </font>
+            <br/> Copyright &#169; 2006 <a
+            href="http://www.wyona.com">Wyona</a>. <i18n:message
+            key="allRightsReserved"/>. - <a href="?yanel.resource.meta">
+              <i18n:message key="pageInfo"/>
+            </a>
+          </div>
+        </div>
+      </body>
+    </html>
+  </xsl:template>
+
+  <xsl:template name="navigation">
+    <b>Testing</b>
+    <br/> &#160;<a href="{$yarep.back2realm}testing-control.html">Testing&#160;Control</a>
+    <br/> &#160;<a href="{$yarep.back2realm}testing-times.html">Time&#160;AnalyzeTime</a>
+    <br/>
+  </xsl:template>
+
+</xsl:stylesheet>


Property changes on: public/yanel/trunk/src/realms/test/yanel/data/xslt/global.xsl
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: public/yanel/trunk/src/realms/test/yanel/rti/.yanel-rti
===================================================================
--- public/yanel/trunk/src/realms/test/yanel/rti/.yanel-rti	2007-01-10 08:56:44 UTC (rev 21583)
+++ public/yanel/trunk/src/realms/test/yanel/rti/.yanel-rti	2007-01-10 10:51:34 UTC (rev 21584)
@@ -1,5 +1,3 @@
-<{http://www.wyona.org/yanel/resource/1.0}file/>
+<{http://www.wyona.org/yanel/resource/1.0}xml/>
 mime-type: application/xhtml+xml
-#
-#<{http://www.wyona.org/yanel/resource/1.0}directory/>
-
+xslt: /xslt/global.xsl
\ No newline at end of file

Modified: public/yanel/trunk/src/realms/test/yanel/rti/testing-control.html.yanel-rti
===================================================================
--- public/yanel/trunk/src/realms/test/yanel/rti/testing-control.html.yanel-rti	2007-01-10 08:56:44 UTC (rev 21583)
+++ public/yanel/trunk/src/realms/test/yanel/rti/testing-control.html.yanel-rti	2007-01-10 10:51:34 UTC (rev 21584)
@@ -1 +1,2 @@
 <{http://www.wyona.org/yanel/resource/1.0}testing-control/>
+xslt: /xslt/global.xsl

Added: public/yanel/trunk/src/realms/test/yanel/rti/testing-times.html.yanel-rti
===================================================================
--- public/yanel/trunk/src/realms/test/yanel/rti/testing-times.html.yanel-rti	2007-01-10 08:56:44 UTC (rev 21583)
+++ public/yanel/trunk/src/realms/test/yanel/rti/testing-times.html.yanel-rti	2007-01-10 10:51:34 UTC (rev 21584)
@@ -0,0 +1,2 @@
+<{http://www.wyona.org/yanel/1.0}testing-times/>
+xslt: /xslt/global.xsl

Added: public/yanel/trunk/src/resources/testing-control/src/java/org/wyona/yanel/impl/resources/ExecuteTests.java
===================================================================
--- public/yanel/trunk/src/resources/testing-control/src/java/org/wyona/yanel/impl/resources/ExecuteTests.java	2007-01-10 08:56:44 UTC (rev 21583)
+++ public/yanel/trunk/src/resources/testing-control/src/java/org/wyona/yanel/impl/resources/ExecuteTests.java	2007-01-10 10:51:34 UTC (rev 21584)
@@ -0,0 +1,136 @@
+/*
+ * Copyright 2006 Wyona
+ *
+ *  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.wyona.org/licenses/APACHE-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.wyona.yanel.impl.resources;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.log4j.Category;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.ZipFileSet;
+import org.apache.tools.ant.taskdefs.optional.junit.JUnitTask;
+import org.apache.tools.ant.taskdefs.optional.junit.BatchTest;
+import org.apache.tools.ant.taskdefs.optional.junit.FormatterElement;
+
+/**
+ * 
+ */
+public class ExecuteTests implements Runnable {
+    
+    private static Category log = Category.getInstance(ExecuteTests.class);
+    private String[] testnames;
+    private File JunitJarLocation;
+    private File HtmlunitJarLocation;
+    private File tmpResultDir;
+    
+    public ExecuteTests(){
+    }
+    
+    public ExecuteTests(String[] testnames, File JunitJarLocation, File HtmlunitJarLocation, File tmpResultDir){
+        this.testnames = testnames;
+        this.JunitJarLocation = JunitJarLocation;
+        this.HtmlunitJarLocation = HtmlunitJarLocation;
+        this.tmpResultDir = tmpResultDir; 
+    }
+    
+    public void setHtmlunitJarLocation(File htmlunitJarLocation) {
+        HtmlunitJarLocation = htmlunitJarLocation;
+    }
+
+    public void setJunitJarLocation(File junitJarLocation) {
+        JunitJarLocation = junitJarLocation;
+    }
+
+    public void setTestnames(String[] testnames) {
+        this.testnames = testnames;
+    }
+
+    public void setTmpResultDir(File tmpResultDir) {
+        this.tmpResultDir = tmpResultDir;
+    }
+
+    public void run(){
+        executeTests();
+    }
+
+    /**
+     * Executes Tests.
+     */
+    private void executeTests() {
+        
+        //make a tmp dir where junit prints the file first and the it 
+        //will be copied to the tmpResultDir to ensure that the files won't 
+        //be read if not finished written
+        File copytmpResultDir = new File(tmpResultDir.getParent()+File.separator+tmpResultDir.getName()+"first");
+        copytmpResultDir.mkdir();
+        
+        Project project = new Project();
+        project.init();
+        
+        ZipFileSet junitzipfileset = new ZipFileSet();
+        ZipFileSet htmlzipfileset = new ZipFileSet();
+        htmlzipfileset.setProject(project);
+        junitzipfileset.setProject(project);
+
+        htmlzipfileset.setSrc(HtmlunitJarLocation);
+        junitzipfileset.setSrc(JunitJarLocation);
+
+        try {
+            JUnitTask junit = new JUnitTask();
+            junit.setProject(project);
+
+            FormatterElement formatter = new FormatterElement();
+            formatter.setUseFile(true);
+            FormatterElement.TypeAttribute typeattribute = new FormatterElement.TypeAttribute();
+            typeattribute.setValue("xml");
+            formatter.setType(typeattribute);
+
+            junit.addFormatter(formatter);
+            junit.setFork(false);
+
+            JUnitTask.SummaryAttribute summaryattr = new JUnitTask.SummaryAttribute();
+            summaryattr.setValue("true");
+            junit.setPrintsummary(summaryattr);
+
+            junit.setHaltonerror(false);
+            junit.setHaltonfailure(false);
+
+            BatchTest batchTest = junit.createBatchTest();
+            batchTest.setTodir(copytmpResultDir);
+
+            for (int i = 0; i < testnames.length; i++) {
+                if(testnames[i].matches(".*Web.*")){
+                    batchTest.addFileSet(htmlzipfileset);
+                    htmlzipfileset.setIncludes(testnames[i]);
+                }else{
+                    batchTest.addFileSet(junitzipfileset);
+                    junitzipfileset.setIncludes(testnames[i]);
+                }
+                junit.init();
+                junit.execute();  
+                
+                String testName = testnames[i].substring(0,testnames[i].indexOf(".")).replaceAll("/",".");
+                File test = new File(copytmpResultDir.getAbsolutePath()+File.separator+"TEST-"+testName+".xml");
+                FileUtils.copyFileToDirectory(test,tmpResultDir);
+            }
+            FileUtils.deleteDirectory(copytmpResultDir);
+        } catch (Exception e) {
+            log.error(e);
+        }
+    }
+}


Property changes on: public/yanel/trunk/src/resources/testing-control/src/java/org/wyona/yanel/impl/resources/ExecuteTests.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: public/yanel/trunk/src/resources/testing-control/src/java/org/wyona/yanel/impl/resources/TestingControlResource.java
===================================================================
--- public/yanel/trunk/src/resources/testing-control/src/java/org/wyona/yanel/impl/resources/TestingControlResource.java	2007-01-10 08:56:44 UTC (rev 21583)
+++ public/yanel/trunk/src/resources/testing-control/src/java/org/wyona/yanel/impl/resources/TestingControlResource.java	2007-01-10 10:51:34 UTC (rev 21584)
@@ -16,40 +16,26 @@
 
 package org.wyona.yanel.impl.resources;
 
-import java.io.BufferedReader;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
-import java.io.FileReader;
 import java.io.InputStream;
-import java.io.StringBufferInputStream;
-import java.io.StringReader;
 import java.io.OutputStream;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.List;
 import java.util.Calendar;
-import java.util.Random;
-
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.Servlet;
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerConfigurationException;
 import javax.xml.transform.TransformerException;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.TransformerFactoryConfigurationError;
-import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import org.w3c.dom.Document;
-import org.xml.sax.XMLReader;
-import org.xml.sax.InputSource;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.log4j.Category;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.DirectoryScanner;
@@ -58,32 +44,18 @@
 import org.apache.tools.ant.types.ZipFileSet;
 import org.apache.tools.ant.taskdefs.optional.junit.JUnitTask;
 import org.apache.tools.ant.taskdefs.optional.junit.BatchTest;
-import org.apache.tools.ant.taskdefs.optional.junit.FormatterElement;
-import org.apache.tools.ant.taskdefs.optional.junit.AggregateTransformer.Format;
-import org.apache.tools.ant.taskdefs.Copy;
-import org.apache.tools.ant.taskdefs.Tstamp;
-import org.apache.tools.ant.taskdefs.Delete;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
 
 import org.wyona.yanel.core.Path;
 import org.wyona.yanel.core.Resource;
-import org.wyona.yanel.core.ResourceTypeDefinition;
-import org.wyona.yanel.core.ResourceTypeRegistry;
 import org.wyona.yanel.core.api.attributes.ViewableV1;
 import org.wyona.yanel.core.attributes.viewable.View;
 import org.wyona.yanel.core.attributes.viewable.ViewDescriptor;
-import org.wyona.yanel.core.map.Realm;
-import org.wyona.yanel.core.util.ResourceAttributeHelper;
 import org.wyona.yarep.core.NoSuchNodeException;
 import org.wyona.yarep.core.Repository;
 import org.wyona.yarep.core.RepositoryFactory;
 import org.wyona.yarep.util.RepoPath;
 import org.wyona.yarep.util.YarepUtil;
-import org.wyona.yanel.impl.resources.ResultAggregator;
 
-import org.apache.commons.io.FileUtils;
-
 /**
  * 
  */
@@ -98,22 +70,13 @@
     private File tmpResultDir;
     private String errorMessage;
 
-    /**
-     * 
-     */
     public TestingControlResource() {
     }
 
-    /**
-     * 
-     */
     public ViewDescriptor[] getViewDescriptors() {
         return null;
     }
 
-    /**
-     * 
-     */
     public View getView(Path path, String viewId) {
         View defaultView = new View();
         defaultView.setMimeType("application/xml");
@@ -122,10 +85,6 @@
         return defaultView;
     }
 
-    /**
-     * @throws Exception
-     * 
-     */
     public View getView(HttpServletRequest request, String viewId) throws Exception {
         Path path = new Path(request.getServletPath());
 
@@ -143,18 +102,13 @@
             errorMessage = errorMessage + "\n JUnit-Tests not found.";
         }
 
-        // create tmp-directroy to write the tests
+        // create tmp-directory to write the tests
         if (!new File(request.getSession().getServletContext().getRealPath("tmp")).exists()) {
             if (!new File(request.getSession().getServletContext().getRealPath("tmp")).mkdir()) {
                 errorMessage = errorMessage + "\n Creation of tmp directory faild.";
             }
         }
 
-        //prepare tmpResultDir
-        String uuid = new java.rmi.server.UID().toString();
-        tmpResultDir = new File(request.getSession().getServletContext().getRealPath("tmp"
-                + File.separator + "test-results-" + uuid));
-
         String submit = request.getParameter("submit");
         String type = request.getParameter("type");
         String archivedResults = request.getParameter("archived-results");
@@ -164,6 +118,9 @@
         if (errorMessage != null) {
             return error();
         }
+        if(request.getSession().getAttribute("tmpResultDir") != null){
+            return showProgress(path, defaultView);
+        }
         if (submit != null) {
             if (testnames != null) {
                 return executeTests(path, defaultView, testnames);
@@ -173,6 +130,7 @@
             }
             return plainRequest(path, defaultView);
         } else {
+
             return plainRequest(path, defaultView);
         }
     }
@@ -190,76 +148,72 @@
         sb.append("<title>Testing Control</title>");
         sb.append("</head>");
         sb.append("<body>");
-        sb.append("<div id=\"contenBody\">");
-        sb.append("<h1>Testing Control</h1>");
-        sb.append("<form method=\"post\">");
-        sb.append("<p>Following htmlunit tests are available:</p>");
 
+        sb.append("<ul id=\"htmlunit\">");
         String[] allHtmlUnitTestNames = getAllTestNames("htmlunit");
-        sb.append("<p>Number of Test: " + allHtmlUnitTestNames.length + "</p>");
 
         for (int i = 0; i < allHtmlUnitTestNames.length; i++) {
-            sb.append("<p>"
-                    + allHtmlUnitTestNames[i].substring(allHtmlUnitTestNames[i].lastIndexOf("/") + 1));
-            sb.append("<input type=\"checkbox\" name=\"testnames\" value=\""
-                    + allHtmlUnitTestNames[i] + "\"/></p>");
+            sb.append("<li title=\""
+                    + allHtmlUnitTestNames[i].substring(allHtmlUnitTestNames[i].lastIndexOf("/") + 1)
+                    + "\">" + allHtmlUnitTestNames[i] + "</li>");
         }
 
-        sb.append("<hr/>");
-        sb.append("<p>Following junit tests are available:</p>");
+        sb.append("</ul>");
+        sb.append("<ul id=\"junit\">");
         String[] allJUnitTestNames = getAllTestNames("junit");
-        sb.append("<p>Number of Test: " + allJUnitTestNames.length + "</p>");
-
         for (int i = 0; i < allJUnitTestNames.length; i++) {
-            sb.append("<p>"
-                    + allJUnitTestNames[i].substring(allJUnitTestNames[i].lastIndexOf("/") + 1));
-            sb.append("<input type=\"checkbox\" name=\"testnames\" value=\"" + allJUnitTestNames[i]
-                    + "\"/></p>");
+            sb.append("<li title=\""
+                    + allJUnitTestNames[i].substring(allJUnitTestNames[i].lastIndexOf("/") + 1)
+                    + "\">" + allJUnitTestNames[i] + "</li>");
         }
+        sb.append("</ul>");
 
-        sb.append("<input type=\"submit\" name=\"submit\" value=\"Test\"/>");
-        sb.append("</form>");
+        // sb.append("<form method=\"post\">");
+        // sb.append("<br/>Archived Test-Results: <select name=\"archived-results\">");
+        // try {
+        // org.wyona.yarep.core.Path testResultArchivePath = new
+        // org.wyona.yarep.util.YarepUtil().getRepositoryPath(new
+        // org.wyona.yarep.core.Path(path.getParent()
+        // .toString()
+        // + "/test-results-archive/"),
+        // getRepositoryFactory())
+        // .getPath();
+        // org.wyona.yarep.core.Path[] children = contentRepo.getChildren(testResultArchivePath);
+        // for (int i = 0; i < children.length; i++) {
+        // if (contentRepo.isResource(children[i])
+        // && children[i].getName()
+        // .matches("[\\d]{4,4}[-][\\d]{2,2}[-][\\d]{2,2}[-][\\d]{2,2}[-][\\d]{2,2}[-][\\d]{2,2}[-]tests\\.xml"))
+        // {
+        // sb.append("<option value=\"" + children[i] + "\">" + children[i].getName()
+        // + "</option>");
+        // }
+        // }
+        // } catch (Exception e) {
+        // log.error(e);
+        // }
+        // sb.append("</select>");
+        // sb.append("<input type=\"submit\" name=\"submit\" value=\"Show\"/>");
+        // sb.append("</form>");
 
-        sb.append("<form method=\"post\">");
-        sb.append("<br/>Archived Test-Results: <select name=\"archived-results\">");
-        try {
-            org.wyona.yarep.core.Path testResultArchivePath = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.getParent()
-                    .toString()
-                    + "/test-results-archive/"),
-                    getRepositoryFactory())
-                    .getPath();
-            org.wyona.yarep.core.Path[] children = contentRepo.getChildren(testResultArchivePath);
-            for (int i = 0; i < children.length; i++) {
-                if (contentRepo.isResource(children[i])
-                        && children[i].getName()
-                                .matches("[\\d]{4,4}[-][\\d]{2,2}[-][\\d]{2,2}[-][\\d]{2,2}[-][\\d]{2,2}[-][\\d]{2,2}[-]tests\\.xml")) {
-                    sb.append("<option value=\"" + children[i] + "\">" + children[i].getName()
-                            + "</option>");
-                }
-            }
-        } catch (Exception e) {
-            log.error(e);
-        }
-        sb.append("</select>");
-        sb.append("<input type=\"submit\" name=\"submit\" value=\"Show\"/>");
-        sb.append("</form>");
-
-        sb.append("</div>");
         sb.append("</body>");
         sb.append("</html>");
 
-        Transformer transformer = TransformerFactory.newInstance()
-                .newTransformer(getXSLTStreamSource(path, contentRepo));
-        transformer.setParameter("yanel.path.name", path.getName());
-        transformer.setParameter("yanel.path", path.toString());
-        transformer.setParameter("yanel.back2context", backToRoot(path, ""));
-        transformer.setParameter("yarep.back2realm",
-                backToRoot(new org.wyona.yanel.core.Path(rp.getPath().toString()), ""));
+        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+        File result2htmlXsltFile = org.wyona.commons.io.FileUtil.file(rtd.getConfigFile()
+                .getParentFile()
+                .getAbsolutePath(), "xslt" + File.separator + "chooseTest.xsl");
+        Transformer transResult2html = TransformerFactory.newInstance()
+                .newTransformer(new StreamSource(result2htmlXsltFile));
+        transResult2html.transform(new StreamSource(new java.io.StringBufferInputStream(sb.toString())),
+                new StreamResult(byteArrayOutputStream));
+
+        Transformer transformer = globalTransformer(path, contentRepo);
         // TODO: Is this the best way to generate an InputStream from an
         // OutputStream?
         java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
-        transformer.transform(new StreamSource(new java.io.StringBufferInputStream(sb.toString())),
+        transformer.transform(new StreamSource(new ByteArrayInputStream(byteArrayOutputStream.toByteArray())),
                 new StreamResult(baos));
+
         defaultView.setMimeType("application/xhtml+xml");
         defaultView.setInputStream(new java.io.ByteArrayInputStream(baos.toByteArray()));
         return defaultView;
@@ -271,67 +225,138 @@
         Repository contentRepo;
         RepoPath rp = contentRepo(path);
         contentRepo = rp.getRepo();
+        
+        // prepare tmpResultDir
+        if (request.getSession().getAttribute("tmpResultDir") == null) {
+            String uuid = new java.rmi.server.UID().toString();
+            tmpResultDir = new File(request.getSession().getServletContext().getRealPath("tmp"
+                    + File.separator + "test-results-" + uuid));
+            request.getSession().setAttribute("tmpResultDir", tmpResultDir);
+        } else {
+            tmpResultDir = (File) request.getSession().getAttribute("tmpResultDir");
+        }        
 
+        request.getSession().setAttribute("exectime", getTime());
+        request.getSession().setAttribute("numberOfTests", ""+testnames.length);
+
         // delete the resultdir before making new tests
         tmpResultDir.mkdir();
+        Runnable runtest = new ExecuteTests(testnames,
+                JunitJarLocation,
+                HtmlunitJarLocation,
+                tmpResultDir);
+        new Thread(runtest).start();
+        return showProgress(path, defaultView);
+    }
 
-        // executing the tests
-        executeTests(testnames);
+    private View showProgress(Path path, View defaultView) throws Exception,
+    TransformerConfigurationException, TransformerFactoryConfigurationError,
+    NoSuchNodeException, TransformerException{
+        Repository contentRepo;
+        RepoPath rp = contentRepo(path);
+        contentRepo = rp.getRepo();
+        
+        //get tmpResultDir from session
+        tmpResultDir = (File) request.getSession().getAttribute("tmpResultDir");
+        
+        //number of executed tests
+        int numberOfTests = Integer.parseInt((String) request.getSession().getAttribute("numberOfTests"));
+        
+        String resultName = request.getSession().getAttribute("exectime") + "-tests.xml";
 
-        // geting the test results
-        DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
-        Document result = builder.newDocument();
-
-        Project project = new Project();
+        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
         
-        // aggregate all tests in the tmp dir
-        try {
-            ResultAggregator junitreport = new ResultAggregator();
-            junitreport.setTaskName("JUnitReport");
-            junitreport.setProject(project);
+        if (tmpResultDir.list().length < numberOfTests) {
+            // geting the test results
+            DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+            Document result = builder.newDocument();
 
-            FileSet fs_report = new FileSet();
-            fs_report.setDir(tmpResultDir);
-            fs_report.setProject(project);
+            Project project = new Project();
 
-            PatternSet.NameEntry ne = fs_report.createInclude();
-            ne.setName("**/TEST-*.xml");
-            junitreport.addFileSet(fs_report);
+            // aggregate all tests in the tmp dir
+            try {
+                ResultAggregator junitreport = new ResultAggregator();
+                junitreport.setTaskName("JUnitReport");
+                junitreport.setProject(project);
 
-            junitreport.init();
-            // get the result to show for this request
-            result = junitreport.getDocument();
-        } catch (Exception e) {
-            log.error(e);
-        }
+                FileSet fs_report = new FileSet();
+                fs_report.setDir(tmpResultDir);
+                fs_report.setProject(project);
 
-        //delete the test dir
-        FileUtils.deleteDirectory(tmpResultDir);
+                PatternSet.NameEntry ne = fs_report.createInclude();
+                ne.setName("**/TEST-*.xml");
+                junitreport.addFileSet(fs_report);
 
-        // write test result to repo
-        OutputStream out = contentRepo.getOutputStream(new Path("/test-results-archive/"
-                + getTime() + "-tests.xml"));
-        javax.xml.transform.TransformerFactory.newInstance()
-                .newTransformer()
-                .transform(new javax.xml.transform.dom.DOMSource(result),
-                        new javax.xml.transform.stream.StreamResult(out));
-        out.close();
+                junitreport.init();
+                // get the result to show for this request
+                result = junitreport.getDocument();
+            } catch (Exception e) {
+                log.error(e);
+            }
 
-        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
-        File result2htmlXsltFile = org.wyona.commons.io.FileUtil.file(rtd.getConfigFile()
-                .getParentFile()
-                .getAbsolutePath(), "xslt" + File.separator + "result2html.xsl");
-        Transformer transResult2html = TransformerFactory.newInstance()
-                .newTransformer(new StreamSource(result2htmlXsltFile));
-        transResult2html.transform(new DOMSource(result), new StreamResult(byteArrayOutputStream));
+            File result2htmlXsltFile = org.wyona.commons.io.FileUtil.file(rtd.getConfigFile()
+                    .getParentFile()
+                    .getAbsolutePath(), "xslt" + File.separator + "result2html.xsl");
+            Transformer transResult2html = TransformerFactory.newInstance()
+                    .newTransformer(new StreamSource(result2htmlXsltFile));
+            transResult2html.setParameter("testing.result.title", "stillTesting");
+            transResult2html.setParameter("testing.number.requested.tests", ""+numberOfTests);
+            transResult2html.transform(new DOMSource(result),
+                    new StreamResult(byteArrayOutputStream));
 
-        Transformer transformer = TransformerFactory.newInstance()
-                .newTransformer(getXSLTStreamSource(path, contentRepo));
-        transformer.setParameter("yanel.path.name", path.getName());
-        transformer.setParameter("yanel.path", path.toString());
-        transformer.setParameter("yanel.back2context", backToRoot(path, ""));
-        transformer.setParameter("yarep.back2realm",
-                backToRoot(new org.wyona.yanel.core.Path(rp.getPath().toString()), ""));
+        } else {
+            request.getSession().removeAttribute("tmpResultDir");
+            request.getSession().removeAttribute("exectime");
+            request.getSession().removeAttribute("numberOfTests");
+            
+            // geting the test results
+            DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+            Document result = builder.newDocument();
+            Project aggregatorproject = new Project();
+            // aggregate all tests in the tmp dir
+            try {
+                ResultAggregator junitreport = new ResultAggregator();
+                junitreport.setTaskName("JUnitReport");
+                junitreport.setProject(aggregatorproject);
+
+                FileSet fs_report = new FileSet();
+                fs_report.setDir(tmpResultDir);
+                fs_report.setProject(aggregatorproject);
+
+                PatternSet.NameEntry ne = fs_report.createInclude();
+                ne.setName("**/TEST-*.xml");
+                junitreport.addFileSet(fs_report);
+
+                junitreport.init();
+                // get the result to show for this request
+                result = junitreport.getDocument();
+            } catch (Exception e) {
+                log.error(e);
+            }
+
+            // write test result to repo
+            OutputStream out = contentRepo.getOutputStream(new Path("/test-results-archive/"
+                    + resultName));
+            javax.xml.transform.TransformerFactory.newInstance()
+                    .newTransformer()
+                    .transform(new javax.xml.transform.dom.DOMSource(result),
+                            new javax.xml.transform.stream.StreamResult(out));
+            out.close();
+            
+            //delete the test dir
+            FileUtils.deleteDirectory(tmpResultDir);   
+            
+            File result2htmlXsltFile = org.wyona.commons.io.FileUtil.file(rtd.getConfigFile()
+                    .getParentFile()
+                    .getAbsolutePath(), "xslt" + File.separator + "result2html.xsl");
+            Transformer transResult2html = TransformerFactory.newInstance()
+                    .newTransformer(new StreamSource(result2htmlXsltFile));
+            transResult2html.setParameter("testing.result.title", "testDone");
+            transResult2html.transform(new DOMSource(result),
+                    new StreamResult(byteArrayOutputStream));
+        }
+
+        Transformer transformer = globalTransformer(path, contentRepo);
         // TODO: Is this the best way to generate an InputStream from an
         // OutputStream?
         java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
@@ -364,13 +389,7 @@
         transResult2html.transform(new StreamSource(inputStream),
                 new StreamResult(byteArrayOutputStream));
 
-        Transformer transformer = TransformerFactory.newInstance()
-                .newTransformer(getXSLTStreamSource(path, contentRepo));
-        transformer.setParameter("yanel.path.name", path.getName());
-        transformer.setParameter("yanel.path", path.toString());
-        transformer.setParameter("yanel.back2context", backToRoot(path, ""));
-        transformer.setParameter("yarep.back2realm",
-                backToRoot(new org.wyona.yanel.core.Path(rp.getPath().toString()), ""));
+        Transformer transformer = globalTransformer(path, contentRepo);
         // TODO: Is this the best way to generate an InputStream from an
         // OutputStream?
         java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
@@ -386,70 +405,43 @@
                 getRepositoryFactory());
     }
 
-    /**
-     * 
-     */
-    private StreamSource getXSLTStreamSource(Path path, Repository repo) throws Exception {
-        Path xsltPath = getXSLTPath(path);
-        if (xsltPath != null) {
-            return new StreamSource(repo.getInputStream(new org.wyona.yarep.core.Path(getXSLTPath(path).toString())));
+    private Transformer globalTransformer(Path path, Repository repo) throws Exception,
+            TransformerConfigurationException {
+        RepoPath rp = contentRepo(path);
+        if (getXSLTPath(path) != null) {
+            Transformer transformer = TransformerFactory.newInstance()
+                    .newTransformer(new StreamSource(repo.getInputStream(getXSLTPath(path))));
+            transformer.setParameter("yanel.path.name", path.getName());
+            transformer.setParameter("yanel.path", path.toString());
+            transformer.setParameter("yanel.back2context", backToRoot(path, ""));
+            transformer.setParameter("yarep.back2realm",
+                    backToRoot(new org.wyona.yanel.core.Path(rp.getPath().toString()), ""));
+            return transformer;
         } else {
-            File xsltFile = org.wyona.commons.io.FileUtil.file(rtd.getConfigFile()
-                    .getParentFile()
-                    .getAbsolutePath(), "xslt" + File.separator + "copyOutput.xsl");
-            log.error("DEBUG: XSLT file: " + xsltFile);
-            return new StreamSource(xsltFile);
+            Transformer transformer = TransformerFactory.newInstance().newTransformer();
+            return transformer;
         }
     }
 
     /**
-     * 
+     * Get XSLT path
      */
     private Path getXSLTPath(Path path) {
-        String xsltPath = null;
-        try {
-            // TODO: Get yanel RTI yarep properties file name from framework
-            // resp. use MapFactory ...!
-            RepoPath rpRTI = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()),
-                    getRTIRepositoryFactory());
-            java.io.BufferedReader br = new java.io.BufferedReader(rpRTI.getRepo()
-                    .getReader(new org.wyona.yarep.core.Path(new Path(rpRTI.getPath().toString()).getRTIPath()
-                            .toString())));
-
-            while ((xsltPath = br.readLine()) != null) {
-                if (xsltPath.indexOf("xslt:") == 0) {
-                    xsltPath = xsltPath.substring(6);
-                    log.debug("XSLT Path: " + xsltPath);
-                    return new Path(xsltPath);
-                }
-            }
-            log.error("No XSLT Path within: " + rpRTI.getPath());
-        } catch (Exception e) {
-            log.warn(e);
-        }
-
+        String xsltPath = getRTI().getProperty("xslt");
+        if (xsltPath != null)
+            return new Path(xsltPath);
+        log.info("No XSLT Path within: " + path);
         return null;
     }
 
-    /**
-     * 
-     * @return
-     */
     protected RepositoryFactory getRepositoryFactory() {
         return yanel.getRepositoryFactory("DefaultRepositoryFactory");
     }
 
-    /**
-     * 
-     * @return
-     */
     protected RepositoryFactory getRTIRepositoryFactory() {
         return yanel.getRepositoryFactory("RTIRepositoryFactory");
     }
 
-    /**
-     * 
-     */
     private String backToRoot(Path path, String backToRoot) {
         org.wyona.commons.io.Path parent = path.getParent();
         if (parent != null && !isRoot(parent)) {
@@ -458,9 +450,6 @@
         return backToRoot;
     }
 
-    /**
-     * 
-     */
     private boolean isRoot(org.wyona.commons.io.Path path) {
         if (path.toString().equals(File.separator))
             return true;
@@ -500,76 +489,17 @@
     }
 
     /**
-     * Executes Tests.
-     * @param testnames which should be executed.
-     */
-    private void executeTests(String[] testnames) throws Exception {
-
-        Project project = new Project();
-        project.init();
-
-        try {
-            JUnitTask junit = new JUnitTask();
-            junit.setProject(project);
-
-            ZipFileSet junitzipfileset = new ZipFileSet();
-            ZipFileSet htmlzipfileset = new ZipFileSet();
-            htmlzipfileset.setProject(project);
-            junitzipfileset.setProject(project);
-
-            htmlzipfileset.setSrc(HtmlunitJarLocation);
-            junitzipfileset.setSrc(JunitJarLocation);
-
-            String includes = "";
-            for (int i = 0; i < testnames.length; i++) {
-                includes = includes + testnames[i] + ",";
-            }
-            htmlzipfileset.setIncludes(includes);
-            junitzipfileset.setIncludes(includes);
-
-            BatchTest batchTest = junit.createBatchTest();
-            batchTest.setTodir(tmpResultDir);
-            batchTest.addFileSet(htmlzipfileset);
-            batchTest.addFileSet(junitzipfileset);
-
-            FormatterElement formatter = new FormatterElement();
-            formatter.setUseFile(true);
-            FormatterElement.TypeAttribute typeattribute = new FormatterElement.TypeAttribute();
-            typeattribute.setValue("xml");
-            formatter.setType(typeattribute);
-
-            junit.addFormatter(formatter);
-            junit.setFork(false);
-
-            JUnitTask.SummaryAttribute summaryattr = new JUnitTask.SummaryAttribute();
-            summaryattr.setValue("true");
-            junit.setPrintsummary(summaryattr);
-
-            org.apache.tools.ant.types.Commandline.Argument cmdline = junit.createJvmarg();
-
-            junit.setHaltonerror(false);
-            junit.setHaltonfailure(false);
-
-            junit.init();
-            junit.execute();
-
-        } catch (Exception e) {
-            log.error(e);
-        }
-    }
-
-    /**
      * get time as string
      * @return timestamp (yyyy-MM-dd-HH-mm-ss)
      */
     private String getTime() {
         Calendar cal = Calendar.getInstance(java.util.TimeZone.getDefault());
-        String DATE_FORMAT = "yyyy-MM-dd-HH-mm-ss";
-        java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(DATE_FORMAT);
+        String dateFormat = "yyyy-MM-dd-HH-mm-ss";
+        java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(dateFormat);
         sdf.setTimeZone(java.util.TimeZone.getDefault());
-        String time = sdf.format(cal.getTime());
-        return time;
+        return sdf.format(cal.getTime());
     }
+
     /**
      * get an error screen
      * @return a view with an error screen

Added: public/yanel/trunk/src/resources/testing-control/xslt/chooseTest.xsl
===================================================================
--- public/yanel/trunk/src/resources/testing-control/xslt/chooseTest.xsl	2007-01-10 08:56:44 UTC (rev 21583)
+++ public/yanel/trunk/src/resources/testing-control/xslt/chooseTest.xsl	2007-01-10 10:51:34 UTC (rev 21584)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet 
+  version="1.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+  xmlns:xhtml="http://www.w3.org/1999/xhtml"
+  xmlns="http://www.w3.org/1999/xhtml"
+  >
+  
+  <xsl:template match="/">
+    <html xmlns="http://www.w3.org/1999/xhtml">
+      <head>
+        <title><xsl:value-of select="/xhtml:html/xhtml:head/xhtml:title"/></title>
+      </head>
+      <body>
+        <div id="contenBody">
+          <h1>Testing Control</h1>
+          <form method="post">
+            <p><xsl:value-of select="count(//xhtml:ul[@id='htmlunit']/xhtml:li)"/> htmlunit tests are available:</p>
+            <xsl:apply-templates select="//xhtml:ul[@id='htmlunit']"/>
+            <hr/>
+            <p><xsl:value-of select="count(//xhtml:ul[@id='junit']/xhtml:li)"/> junit tests are available:</p>
+            <xsl:apply-templates select="//xhtml:ul[@id='junit']"/>
+            <input type="submit" name="submit" value="Test"/>
+          </form>
+          <form method="post">
+            <xsl:apply-templates select="//xhtml:ul" mode="all"/>
+            <input type="submit" name="submit" value="execute all Tests"/>
+          </form>
+<!--           <form method="post">
+            <br/>Archived Test-Results: <select name="archived-results">
+              <option value="//test-results-archive/2006-12-20-09-39-19-tests.xml">2006-12-20-09-39-19-tests.xml</option>
+            </select>
+            <input type="submit" name="submit" value="Show"/>
+          </form> -->
+        </div>
+      </body>
+    </html>
+  </xsl:template>
+  
+  <xsl:template match="xhtml:li">
+    <p>
+      <input type="checkbox" name="testnames" value="{.}"/>
+      <xsl:value-of select="substring-before(@title,'.')"/>
+    </p>
+  </xsl:template>
+
+  <xsl:template match="xhtml:li" mode="all">
+    <input type="hidden" name="testnames" value="{.}"/>
+  </xsl:template>
+  
+</xsl:stylesheet>


Property changes on: public/yanel/trunk/src/resources/testing-control/xslt/chooseTest.xsl
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: public/yanel/trunk/src/resources/testing-control/xslt/copyOutput.xsl
===================================================================
--- public/yanel/trunk/src/resources/testing-control/xslt/copyOutput.xsl	2007-01-10 08:56:44 UTC (rev 21583)
+++ public/yanel/trunk/src/resources/testing-control/xslt/copyOutput.xsl	2007-01-10 10:51:34 UTC (rev 21584)
@@ -1,31 +0,0 @@
-<?xml version="1.0"?>
-
-<xsl:stylesheet version="1.0"
-  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-  xmlns="http://www.w3.org/1999/xhtml"
-  xmlns:xhtml="http://www.w3.org/1999/xhtml"
-  xmlns:dir="http://apache.org/cocoon/directory/2.0"
-  xmlns:yanel="http://www.wyona.org/yanel/resource/directory/1.0"
->
-
-<xsl:output method="xhtml"/>
-<!-- NOTE: Must correspond with the mime-type delivered by the server. See src/java/org/wyona/yanel/impl/resources/DirectoryResource.java -->
-<!--
-<xsl:output method="html"/>
--->
-
-<xsl:template match="/">
-
-        <xsl:apply-templates/>
-
-</xsl:template>
-
-
-
-  <xsl:template match="@*|node()" priority="-2">
-    <xsl:copy>
-      <xsl:apply-templates select="@*|node()"/>
-    </xsl:copy>
-  </xsl:template>
-  
-</xsl:stylesheet>

Modified: public/yanel/trunk/src/resources/testing-control/xslt/result2html.xsl
===================================================================
--- public/yanel/trunk/src/resources/testing-control/xslt/result2html.xsl	2007-01-10 08:56:44 UTC (rev 21583)
+++ public/yanel/trunk/src/resources/testing-control/xslt/result2html.xsl	2007-01-10 10:51:34 UTC (rev 21584)
@@ -5,6 +5,7 @@
   <xsl:output method="html"/>
   
   <xsl:param name="testing.result.title" select="'current test'"/>
+  <xsl:param name="testing.number.requested.tests"/>
   
   <xsl:variable name="testsuite.list" select="//testsuite"/>
   <xsl:variable name="testcase.list" select="$testsuite.list/testcase"/>
@@ -14,12 +15,31 @@
   <xsl:template match="/">
     <html>
       <head>
+        <xsl:if test="$testing.result.title = 'stillTesting'">
+          <meta http-equiv="refresh" content="5; URL="/>
+        </xsl:if>
         <title>Testing Results</title>
       </head>
       <body>
         <div id="contenBody">
-          <h1>Testing results of <xsl:value-of select="$testing.result.title"/></h1>
-          <p>Executed Testcases: <xsl:value-of select="count($testcase.list)"/></p>
+          <h1>
+          <xsl:choose>
+            <xsl:when test="$testing.result.title = 'stillTesting'">
+              Tests are running...
+            </xsl:when>
+            <xsl:when test="$testing.result.title = 'testDone'">
+              Tests are done.
+            </xsl:when>
+            <xsl:otherwise>
+              Testing results of <xsl:value-of select="$testing.result.title"/>
+            </xsl:otherwise>
+          </xsl:choose>
+          </h1>
+          <p>Executed Testcases: <xsl:value-of select="count($testcase.list)"/>
+            <xsl:if test="$testing.result.title = 'stillTesting'">
+              of <xsl:value-of select="$testing.number.requested.tests"/>
+            </xsl:if>
+          </p>
           <p>Successful: <xsl:value-of select="count($testcase.list) - count($testcase.failure.list) - count($testcase.error.list)"/>,
           Failures: <xsl:value-of select="count($testcase.failure.list)"/>,
           Errors: <xsl:value-of select="count($testcase.error.list)"/></p>




More information about the Yanel-commits mailing list