cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dani...@apache.org
Subject svn commit: r111383 - cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg
Date Thu, 09 Dec 2004 13:39:51 GMT
Author: danielf
Date: Thu Dec  9 05:39:50 2004
New Revision: 111383

URL: http://svn.apache.org/viewcvs?view=rev&rev=111383
Log:
Initial set of test cases for JXTG. The *EnvExpression* test cases are faulty and failed even
before refactoring, don't know why I don't succeed in passing the cocoon object to JXTG in
the test case.
Added:
   cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/
   cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-generate.xml
   cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jexlEnvExpression-output.xml
   cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jexlEnvExpression.xml
   cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jexlExpression-output.xml
   cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jexlExpression.xml
   cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jxpathEnvExpression-output.xml
   cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jxpathEnvExpression.xml
   cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jxpathExpression-output.xml
   cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jxpathExpression.xml
   cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGeneratorTestCase.java
   cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGeneratorTestCase.xtest

Added: cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-generate.xml
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-generate.xml?view=auto&rev=111383
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-generate.xml
Thu Dec  9 05:39:50 2004
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+
+<root>
+  text
+
+  <item attr="1">
+    Some text
+  </item>
+  <item attr="2">
+    More text
+  </item>
+
+</root>

Added: cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jexlEnvExpression-output.xml
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jexlEnvExpression-output.xml?view=auto&rev=111383
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jexlEnvExpression-output.xml
Thu Dec  9 05:39:50 2004
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+
+<root>
+  protocol: HTTP/1.1
+
+  <item attr="** foo **">
+    Some text
+  </item>
+
+</root>

Added: cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jexlEnvExpression.xml
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jexlEnvExpression.xml?view=auto&rev=111383
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jexlEnvExpression.xml
Thu Dec  9 05:39:50 2004
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+
+<root>
+  protocol: ${cocoon.request.protocol}
+
+  <item attr="** ${parameters.test} **">
+    Some text
+  </item>
+
+</root>

Added: cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jexlExpression-output.xml
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jexlExpression-output.xml?view=auto&rev=111383
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jexlExpression-output.xml
Thu Dec  9 05:39:50 2004
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+
+<root>
+  text 3
+
+  <item attr="** 7 **">
+    Some text
+  </item>
+
+</root>

Added: cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jexlExpression.xml
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jexlExpression.xml?view=auto&rev=111383
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jexlExpression.xml
Thu Dec  9 05:39:50 2004
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+
+<root>
+  text ${1 + 2}
+
+  <item attr="** ${3 + 4} **">
+    Some text
+  </item>
+
+</root>

Added: cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jxpathEnvExpression-output.xml
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jxpathEnvExpression-output.xml?view=auto&rev=111383
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jxpathEnvExpression-output.xml
Thu Dec  9 05:39:50 2004
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+
+<root>
+  protocol: HTTP/1.1
+
+  <item attr="** foo **">
+    Some text
+  </item>
+
+</root>

Added: cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jxpathEnvExpression.xml
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jxpathEnvExpression.xml?view=auto&rev=111383
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jxpathEnvExpression.xml
Thu Dec  9 05:39:50 2004
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+
+<root>
+  protocol: #{$cocoon.request.protocol}
+
+  <item attr="** #{$cocoon/parameters/test} **">
+    Some text
+  </item>
+
+</root>

Added: cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jxpathExpression-output.xml
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jxpathExpression-output.xml?view=auto&rev=111383
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jxpathExpression-output.xml
Thu Dec  9 05:39:50 2004
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+
+<root>
+  text 3.0
+
+  <item attr="** 7.0 **">
+    Some text
+  </item>
+
+</root>

Added: cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jxpathExpression.xml
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jxpathExpression.xml?view=auto&rev=111383
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGenerator-jxpathExpression.xml
Thu Dec  9 05:39:50 2004
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+
+<root>
+  text #{1 + 2}
+
+  <item attr="** #{3 + 4} **">
+    Some text
+  </item>
+
+</root>

Added: cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGeneratorTestCase.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGeneratorTestCase.java?view=auto&rev=111383
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGeneratorTestCase.java
Thu Dec  9 05:39:50 2004
@@ -0,0 +1,80 @@
+/*
+ * 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.cocoon.template.jxtg;
+
+import org.apache.avalon.framework.logger.ConsoleLogger;
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.cocoon.SitemapComponentTestCase;
+import org.apache.cocoon.environment.ObjectModelHelper;
+
+public class JXTemplateGeneratorTestCase extends SitemapComponentTestCase {
+    Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_WARN);
+    String docBase = "resource://org/apache/cocoon/template/jxtg/";
+    String JX = "jx";
+
+    public Logger getLogger() {
+        return this.logger;
+    }
+
+    public void testGenerate() throws Exception {
+        String inputURI = docBase + "JXTemplateGenerator-generate.xml";
+
+        assertEqual(load(inputURI), generate(JX, inputURI, EMPTY_PARAMS));
+    }
+
+    public void testJexlExpression() throws Exception {
+        String inputURI = docBase + "JXTemplateGenerator-jexlExpression.xml";
+        String outputURI = docBase + "JXTemplateGenerator-jexlExpression-output.xml";
+
+        String protocol = ObjectModelHelper.getRequest(getObjectModel()).getProtocol();
+        assertEquals("HTTP/1.1", protocol);
+
+        Parameters parameters = new Parameters();
+        parameters.setParameter("test", "foo");
+        assertEqual(load(outputURI), generate(JX, inputURI, EMPTY_PARAMS));
+    }
+
+    public void testJexlEnvExpression() throws Exception {
+        String inputURI = docBase + "JXTemplateGenerator-jexlEnvExpression.xml";
+        String outputURI = docBase + "JXTemplateGenerator-jexlEnvExpression-output.xml";
+
+        String protocol = ObjectModelHelper.getRequest(getObjectModel()).getProtocol();
+        assertEquals("HTTP/1.1", protocol);
+
+        Parameters parameters = new Parameters();
+        parameters.setParameter("test", "foo");
+        assertEqual(load(outputURI), generate(JX, inputURI, EMPTY_PARAMS));
+    }
+
+    public void testJXPathExpression() throws Exception {
+        String inputURI = docBase + "JXTemplateGenerator-jxpathExpression.xml";
+        String outputURI = docBase + "JXTemplateGenerator-jxpathExpression-output.xml";
+
+        Parameters parameters = new Parameters();
+        parameters.setParameter("test", "foo");
+        assertEqual(load(outputURI), generate(JX, inputURI, EMPTY_PARAMS));
+    }
+
+    public void testJXPathEnvExpression() throws Exception {
+        String inputURI = docBase + "JXTemplateGenerator-jxpathEnvExpression.xml";
+        String outputURI = docBase + "JXTemplateGenerator-jxpathEnvExpression-output.xml";
+
+        Parameters parameters = new Parameters();
+        parameters.setParameter("test", "foo");
+        assertEqual(load(outputURI), generate(JX, inputURI, EMPTY_PARAMS));
+    }
+}

Added: cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGeneratorTestCase.xtest
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGeneratorTestCase.xtest?view=auto&rev=111383
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/template/test/org/apache/cocoon/template/jxtg/JXTemplateGeneratorTestCase.xtest
Thu Dec  9 05:39:50 2004
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+<!--
+  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.
+-->
+
+<testcase>
+  <roles>
+    <role name="org.apache.excalibur.xml.sax.SAXParser"
+      shorthand="xml-parser"
+      default-class="org.apache.excalibur.xml.impl.JaxpParser"/>
+    <role name="org.apache.cocoon.generation.GeneratorSelector"
+      shorthand="generators"
+      default-class="org.apache.cocoon.core.container.CocoonServiceSelector"/>
+  </roles>
+ 
+  <components>
+    <xml-parser class="org.apache.excalibur.xml.impl.JaxpParser">
+      <parameter name="validate" value="false"/>
+      <parameter name="namespace-prefixes" value="false"/>
+      <parameter name="stop-on-warning" value="true"/>
+      <parameter name="stop-on-recoverable-error" value="true"/>
+      <parameter name="reuse-parsers" value="false"/>
+    </xml-parser>
+
+    <generators logger="test">
+      <component-instance class="org.apache.cocoon.template.jxtg.JXTemplateGenerator"

+        name="jx"/>
+    </generators>
+
+  </components>
+ 
+</testcase>
+ 

Mime
View raw message