forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thors...@apache.org
Subject svn commit: r703382 - in /forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src: java/org/apache/forrest/dispatcher/config/ java/org/apache/forrest/dispatcher/factories/ java/org/apache/forrest/dispatcher/impl/ j...
Date Fri, 10 Oct 2008 10:18:24 GMT
Author: thorsten
Date: Fri Oct 10 03:18:10 2008
New Revision: 703382

URL: http://svn.apache.org/viewvc?rev=703382&view=rev
Log:
We only need one instance of the stax helper since we can reuse the factories allover the
place. Creating instance of factories is resource expensive.

Modified:
    forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/config/DispatcherBean.java
    forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/factories/ContractFactory.java
    forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/XMLStructurer.java
    forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/XSLContract.java
    forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/helper/StAX.java
    forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/helper/XSLContractHelper.java
    forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
    forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/testing/org/apache/forrest/dispatcher/TestContract.java
    forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/testing/org/apache/forrest/dispatcher/TestStructurer.java
    forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/testing/org/apache/forrest/dispatcher/TestStructurerAXIOM.java

Modified: forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/config/DispatcherBean.java
URL: http://svn.apache.org/viewvc/forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/config/DispatcherBean.java?rev=703382&r1=703381&r2=703382&view=diff
==============================================================================
--- forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/config/DispatcherBean.java
(original)
+++ forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/config/DispatcherBean.java
Fri Oct 10 03:18:10 2008
@@ -19,6 +19,7 @@
 import javax.xml.transform.URIResolver;
 
 import org.apache.forrest.dispatcher.api.Resolver;
+import org.apache.forrest.dispatcher.impl.helper.StAX;
 
 /**
  * The dispatcherBean is holding all configuration information that are needed
@@ -205,5 +206,15 @@
   public URIResolver getUriResolver() {
     return uriResolver;
   }
+  
+  private StAX staxHelper;
+
+  public void setStaxHelper(StAX staxHelper) {
+    this.staxHelper = staxHelper;
+  }
+  
+  public StAX getStaxHelper() {
+    return staxHelper;
+  }
 
 }

Modified: forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/factories/ContractFactory.java
URL: http://svn.apache.org/viewvc/forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/factories/ContractFactory.java?rev=703382&r1=703381&r2=703382&view=diff
==============================================================================
--- forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/factories/ContractFactory.java
(original)
+++ forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/factories/ContractFactory.java
Fri Oct 10 03:18:10 2008
@@ -68,7 +68,7 @@
        * requested contract does not exist. Otherwise it is a xsl based
        * contract.
        */
-      contract = new XSLContract(config.isAllowXmlProperties(),config.getUriResolver());
+      contract = new XSLContract(config.isAllowXmlProperties(),config.getUriResolver(),config.getStaxHelper());
       String uri = config.getContractUriPrefix() + name + config.getContractUriSufix();
       InputStream xslStream = config.getResolver().resolve(uri);
       contract.initializeFromStream(xslStream);
@@ -83,4 +83,5 @@
     }
     return contract;
   }
+
 }

Modified: forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/XMLStructurer.java
URL: http://svn.apache.org/viewvc/forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/XMLStructurer.java?rev=703382&r1=703381&r2=703382&view=diff
==============================================================================
--- forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/XMLStructurer.java
(original)
+++ forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/XMLStructurer.java
Fri Oct 10 03:18:10 2008
@@ -27,13 +27,16 @@
 import org.apache.forrest.dispatcher.exception.DispatcherException;
 import org.apache.forrest.dispatcher.factories.ContractFactory;
 import org.apache.forrest.dispatcher.impl.helper.Captions;
+import org.apache.forrest.dispatcher.impl.helper.Loggable;
 import org.apache.forrest.dispatcher.impl.helper.StAX;
 import org.apache.forrest.dispatcher.impl.helper.StreamHelper;
 import org.apache.forrest.dispatcher.utils.CommonString;
 
-public class XMLStructurer extends StAX implements Structurer {
+public class XMLStructurer extends Loggable implements Structurer {
 
   private final Resolver resolver;
+  
+  private StAX stax;
 
   private final boolean allowXmlProperties;
 
@@ -47,8 +50,20 @@
 
   private boolean shrink;
 
+  /**
+   * The Streaming API for XML (StAX) is a Java based API for pull-parsing XML.
+   *<p>
+   * This implementation is 100% StAX even the generation of the resulting document
+   * is done with StAX. This has some limitation in comparison with the AXIOM implementation.
+   * <p><strong>No real support of xpath expressions.</strong> You can
not freely allocate a node and append the
+   * result of a contract. We will generate the path but not always as child.
+   *  
+   * @param config
+   * @param defaultProperties
+   */
   public XMLStructurer(DispatcherBean config, Map<String, Object> defaultProperties)
{
     this.contractRep = new ContractFactory(config);
+    this.stax = config.getStaxHelper();
     this.resolver = config.getResolver();
     this.allowXmlProperties = config.isAllowXmlProperties();
     this.shrink = config.isShrink();
@@ -69,7 +84,7 @@
       throws DispatcherException {
     BufferedInputStream stream = null;
     try {
-      XMLStreamReader reader = getReader(structurerStream);
+      XMLStreamReader reader = stax.getReader(structurerStream);
       boolean process = true;
       while (process) {
         int event = reader.next();
@@ -135,7 +150,7 @@
       case XMLStreamConstants.END_ELEMENT:
         elementName = reader.getLocalName();
         if (elementName.equals(Captions.STRUCTURE_ELEMENT)) {
-          XMLEventWriter writer = getWriter(out);
+          XMLEventWriter writer = stax.getWriter(out);
           createResultStax(writer);
           resultTree.clear();
           process = false;
@@ -174,7 +189,7 @@
   private void createResultStax(XMLEventWriter writer)
       throws XMLStreamException {
     // We start with creating a new result document
-    writer.add(getEventFactory().createStartDocument("UTF-8", "1.0"));
+    writer.add(stax.getEventFactory().createStartDocument("UTF-8", "1.0"));
     // get a iterator about the injectionPoints we use
     Iterator<String> iterator = resultTree.keySet().iterator();
     // create an path array
@@ -195,22 +210,22 @@
         closingPaths(writer, split);
       } else {
         if (replaceFirst != null && !replaceFirst.equals("")) {
-          StartElement start = getEventFactory().createStartElement("", "",
+          StartElement start = stax.getEventFactory().createStartElement("", "",
               replaceFirst);
           writer.add((XMLEvent) start);
         }else if(element.equals("/")){
-          StartElement start = getEventFactory().createStartElement("", "",
+          StartElement start = stax.getEventFactory().createStartElement("", "",
               "result");
           writer.add((XMLEvent) start);
         }
 
         injectResult(writer, element);
         if (replaceFirst != null && !replaceFirst.equals("")) {
-          EndElement end = getEventFactory().createEndElement("", "",
+          EndElement end = stax.getEventFactory().createEndElement("", "",
               replaceFirst);
           writer.add((XMLEvent) end);
         }else if(element.equals("/")){
-          EndElement end = getEventFactory().createEndElement("", "",
+          EndElement end = stax.getEventFactory().createEndElement("", "",
               "result");
           writer.add((XMLEvent) end);
     }
@@ -219,7 +234,7 @@
 
     }
     closingPaths(writer, tokenizer);
-    writer.add(getEventFactory().createEndDocument());
+    writer.add(stax.getEventFactory().createEndDocument());
   }
 
   private void processContract(XMLStreamReader reader)
@@ -288,7 +303,7 @@
 
   private void processContractResult(InputStream resultStream)
       throws XMLStreamException {
-    XMLStreamReader contractResultReader = getReader(resultStream);
+    XMLStreamReader contractResultReader = stax.getReader(resultStream);
     String xpath = "", injectionPoint = "";
     LinkedHashSet<XMLEvent> pathElement = null;
     boolean process = true;
@@ -348,10 +363,10 @@
     } else {
       pathElement = new LinkedHashSet<XMLEvent>();
     }
-    XMLEventAllocator allocator = getEventAllocator();
+    XMLEventAllocator allocator = stax.getEventAllocator();
     XMLEvent currentEvent = allocator.allocate(reader);
     if (start){
-      currentEvent = createStartElementNS(reader, currentEvent);
+      currentEvent = stax.createStartElementNS(reader, currentEvent);
     }
     pathElement.add(currentEvent);
     resultTree.put(currentPath, pathElement);
@@ -360,7 +375,7 @@
   private void inject(LinkedHashSet<XMLEvent> pathElement,
       XMLStreamReader parser, String injectionPoint) throws XMLStreamException {
     log.debug("injectionPoint " + injectionPoint);
-    XMLEventAllocator allocator = getEventAllocator();
+    XMLEventAllocator allocator = stax.getEventAllocator();
     boolean process = true;
     while (process) {
       int event = parser.next();
@@ -397,14 +412,14 @@
         propertyValue = reader.getAttributeValue(i);
       }
     }
-    addProperties(reader, localParam, propertyName, propertyValue,allowXmlProperties, shrink);
+    stax.addProperties(reader, localParam, propertyName, propertyValue,allowXmlProperties,
shrink);
   }
 
   private void openPaths(XMLEventWriter writer, String[] tokenizer)
       throws XMLStreamException {
     for (String string : tokenizer) {
       if (!string.equals("")) {
-        StartElement value = getEventFactory().createStartElement("", "",
+        StartElement value = stax.getEventFactory().createStartElement("", "",
             string);
         writer.add((XMLEvent) value);
       }
@@ -416,7 +431,7 @@
     // closing the initial paths again
     for (int j = tokenizer.length - 1; j >= 0; j--) {
       if (!tokenizer[j].equals("")) {
-        EndElement value = getEventFactory().createEndElement("", "",
+        EndElement value = stax.getEventFactory().createEndElement("", "",
             tokenizer[j]);
         writer.add((XMLEvent) value);
       }

Modified: forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/XSLContract.java
URL: http://svn.apache.org/viewvc/forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/XSLContract.java?rev=703382&r1=703381&r2=703382&view=diff
==============================================================================
--- forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/XSLContract.java
(original)
+++ forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/XSLContract.java
Fri Oct 10 03:18:10 2008
@@ -34,6 +34,7 @@
 import org.apache.forrest.dispatcher.exception.ContractException;
 
 import org.apache.forrest.dispatcher.impl.helper.Loggable;
+import org.apache.forrest.dispatcher.impl.helper.StAX;
 import org.apache.forrest.dispatcher.impl.helper.XSLContractHelper;
 
 public class XSLContract extends Loggable implements Contract {
@@ -44,13 +45,13 @@
 
   private boolean allowXmlProperties = false;
 
-  public XSLContract(boolean allowXmlProperties, URIResolver uriResolver) throws ContractException
{
+  public XSLContract(boolean allowXmlProperties, URIResolver uriResolver,StAX stax) throws
ContractException {
     this.allowXmlProperties = allowXmlProperties;
     /*
      * get a new instance of the corresponding helper class since the helper is
      * doing the actual work
      */
-    helper = new XSLContractHelper(uriResolver);
+    helper = new XSLContractHelper(uriResolver,stax);
   }
 
   public BufferedInputStream execute(InputStream dataStream,

Modified: forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/helper/StAX.java
URL: http://svn.apache.org/viewvc/forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/helper/StAX.java?rev=703382&r1=703381&r2=703382&view=diff
==============================================================================
--- forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/helper/StAX.java
(original)
+++ forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/helper/StAX.java
Fri Oct 10 03:18:10 2008
@@ -16,7 +16,6 @@
  */
 package org.apache.forrest.dispatcher.impl.helper;
 
-import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -42,8 +41,7 @@
 import javax.xml.stream.events.XMLEvent;
 import javax.xml.stream.util.XMLEventAllocator;
 
-import org.xml.sax.InputSource;
-
+import com.ctc.wstx.api.WstxOutputProperties;
 import com.ctc.wstx.evt.DefaultEventAllocator;
 
 /**
@@ -53,13 +51,13 @@
  * 
  */
 public class StAX extends Loggable {
-  private XMLOutputFactory outputFactory = null;
+  private static XMLOutputFactory outputFactory = null;
 
   private static XMLEventFactory eventFactory;
 
-  private XMLInputFactory inputFactory = null;
+  private static XMLInputFactory inputFactory = null;
 
-  private XMLInputFactory nsInputFactory= null;
+  private static XMLInputFactory nsInputFactory= null;
 
   /**
    * Easy helper to get StAX based reader and writer.
@@ -68,6 +66,8 @@
     inputFactory = XMLInputFactory.newInstance();
     inputFactory.setEventAllocator(DefaultEventAllocator.getDefaultInstance());
     outputFactory = XMLOutputFactory.newInstance();
+    outputFactory.setProperty(WstxOutputProperties.P_OUTPUT_VALIDATE_STRUCTURE, Boolean.TRUE);
+    outputFactory.setProperty(WstxOutputProperties.P_OUTPUT_VALIDATE_NAMES, Boolean.TRUE);
     eventFactory = XMLEventFactory.newInstance();
   }
 
@@ -287,7 +287,7 @@
    * @param shrink 
    * @throws XMLStreamException
    */
-  protected void addProperties(XMLStreamReader reader, Map<String, Object> param,
+  public void addProperties(XMLStreamReader reader, Map<String, Object> param,
       String propertyName, String propertyValue,boolean allowXmlProperties, boolean shrink)
throws XMLStreamException {
     /*
      *  if we are in allowXmlProperties mode then

Modified: forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/helper/XSLContractHelper.java
URL: http://svn.apache.org/viewvc/forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/helper/XSLContractHelper.java?rev=703382&r1=703381&r2=703382&view=diff
==============================================================================
--- forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/helper/XSLContractHelper.java
(original)
+++ forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/impl/helper/XSLContractHelper.java
Fri Oct 10 03:18:10 2008
@@ -47,13 +47,15 @@
 import org.apache.forrest.dispatcher.impl.XSLContract;
 import org.xml.sax.SAXException;
 
-public class XSLContractHelper extends StAX {
+public class XSLContractHelper extends Loggable{
 
   private Transformer transformer = null;
   private URIResolver uriResolver = null;
+  private StAX stax = null;
 
-  public XSLContractHelper(URIResolver uriResolver) {
+  public XSLContractHelper(URIResolver uriResolver,StAX stax) {
     this.uriResolver = uriResolver;
+    this.stax = stax;
   }
 
   /**
@@ -120,7 +122,7 @@
    */
   public ByteArrayOutputStream createEmptyXmlOutput() throws XMLStreamException {
     ByteArrayOutputStream out = new ByteArrayOutputStream();
-    XMLStreamWriter writer = getStreamWriter(out);
+    XMLStreamWriter writer = stax.getStreamWriter(out);
     writer.writeStartDocument("UTF-8", "1.0");
     writer.writeStartElement("foo");
     writer.writeEndDocument();
@@ -157,7 +159,7 @@
    */
   public void setTemplate(InputStream stream, XSLContract contract)
       throws XMLStreamException, ContractException {
-    XMLStreamReader reader = getNSReader(stream);
+    XMLStreamReader reader = stax.getNSReader(stream);
     boolean process = true;
     while (process) {
       int event = reader.next();
@@ -192,10 +194,10 @@
   private Source processTemplate(XMLStreamReader reader) throws ContractException{
     ByteArrayOutputStream out = new ByteArrayOutputStream();
     try {
-      XMLEventWriter writer = getWriter(out);
+      XMLEventWriter writer = stax.getWriter(out);
       // Making sure we always have all ns 
       // A wee bit brute force but it works
-      XMLEventAllocator allocator = getNSEventAllocator();
+      XMLEventAllocator allocator = stax.getNSEventAllocator();
       String role = "";
       for (int i = 0; i < reader.getAttributeCount(); i++) {
         // Get attribute name

Modified: forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
URL: http://svn.apache.org/viewvc/forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java?rev=703382&r1=703381&r2=703382&view=diff
==============================================================================
--- forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
(original)
+++ forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
Fri Oct 10 03:18:10 2008
@@ -52,6 +52,7 @@
 import org.apache.forrest.dispatcher.impl.XMLStructurer;
 import org.apache.forrest.dispatcher.impl.XMLStructurerAxiom;
 import org.apache.forrest.dispatcher.impl.helper.Captions;
+import org.apache.forrest.dispatcher.impl.helper.StAX;
 import org.apache.forrest.dispatcher.impl.helper.XMLProperties;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
@@ -179,6 +180,7 @@
     // creating a new config and store the general not request specific
     // parameters here
     config = new DispatcherBean();
+    config.setStaxHelper(new StAX());
     boolean allowXml = configuration.getChild("allowXml").getValueAsBoolean(
         false);
     config.setAllowXmlProperties(allowXml);

Modified: forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/testing/org/apache/forrest/dispatcher/TestContract.java
URL: http://svn.apache.org/viewvc/forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/testing/org/apache/forrest/dispatcher/TestContract.java?rev=703382&r1=703381&r2=703382&view=diff
==============================================================================
--- forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/testing/org/apache/forrest/dispatcher/TestContract.java
(original)
+++ forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/testing/org/apache/forrest/dispatcher/TestContract.java
Fri Oct 10 03:18:10 2008
@@ -25,6 +25,7 @@
 import org.apache.forrest.dispatcher.api.Contract;
 import org.apache.forrest.dispatcher.exception.DispatcherException;
 import org.apache.forrest.dispatcher.impl.XSLContract;
+import org.apache.forrest.dispatcher.impl.helper.StAX;
 import org.xml.sax.InputSource;
 
 import junit.framework.TestCase;
@@ -33,7 +34,7 @@
 
   private static final String CONTRACT_XML = "master.contract.xml";
   public void testContractWithoutParameter() throws DispatcherException, FileNotFoundException
{
-    Contract contract = new XSLContract(false, null);
+    Contract contract = new XSLContract(false, null, new StAX());
     InputStream xslStream = this.getClass().getResourceAsStream(CONTRACT_XML);
     contract.initializeFromStream(xslStream);
     // testing the transformation without parameters
@@ -41,7 +42,7 @@
     contract.execute(null, properties);
   }
   public void testContractWithParameter() throws DispatcherException, FileNotFoundException
{
-    Contract contract = new XSLContract(false, null);
+    Contract contract = new XSLContract(false, null, new StAX());
     InputStream xslStream = this.getClass().getResourceAsStream(CONTRACT_XML);
     contract.initializeFromStream(xslStream);
     Map<String, Object> properties = new HashMap<String, Object>();
@@ -50,7 +51,7 @@
     contract.execute(null, properties);
   }
   public void testContractWithXMLParameter() throws DispatcherException, FileNotFoundException
{
-    Contract contract = new XSLContract(true, null);
+    Contract contract = new XSLContract(true, null, new StAX());
     InputStream xslStream = this.getClass().getResourceAsStream(CONTRACT_XML);
     contract.initializeFromStream(xslStream);
     Map<String, Object> properties = new HashMap<String, Object>();

Modified: forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/testing/org/apache/forrest/dispatcher/TestStructurer.java
URL: http://svn.apache.org/viewvc/forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/testing/org/apache/forrest/dispatcher/TestStructurer.java?rev=703382&r1=703381&r2=703382&view=diff
==============================================================================
--- forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/testing/org/apache/forrest/dispatcher/TestStructurer.java
(original)
+++ forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/testing/org/apache/forrest/dispatcher/TestStructurer.java
Fri Oct 10 03:18:10 2008
@@ -8,6 +8,7 @@
 import org.apache.forrest.dispatcher.exception.DispatcherException;
 import org.apache.forrest.dispatcher.impl.ClassPathResolver;
 import org.apache.forrest.dispatcher.impl.XMLStructurer;
+import org.apache.forrest.dispatcher.impl.helper.StAX;
 
 import junit.framework.TestCase;
 
@@ -34,6 +35,7 @@
 
   private Structurer prepareStructurer(boolean allowXml) {
     DispatcherBean config = new DispatcherBean();
+    config.setStaxHelper(new StAX());
     config.setAllowXmlProperties(allowXml);
     config.setResolver(new ClassPathResolver());
     config.setContractUriPrefix("/org/apache/forrest/dispatcher/");

Modified: forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/testing/org/apache/forrest/dispatcher/TestStructurerAXIOM.java
URL: http://svn.apache.org/viewvc/forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/testing/org/apache/forrest/dispatcher/TestStructurerAXIOM.java?rev=703382&r1=703381&r2=703382&view=diff
==============================================================================
--- forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/testing/org/apache/forrest/dispatcher/TestStructurerAXIOM.java
(original)
+++ forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/testing/org/apache/forrest/dispatcher/TestStructurerAXIOM.java
Fri Oct 10 03:18:10 2008
@@ -9,6 +9,7 @@
 import org.apache.forrest.dispatcher.exception.DispatcherException;
 import org.apache.forrest.dispatcher.impl.ClassPathResolver;
 import org.apache.forrest.dispatcher.impl.XMLStructurerAxiom;
+import org.apache.forrest.dispatcher.impl.helper.StAX;
 
 import junit.framework.TestCase;
 
@@ -41,6 +42,7 @@
   
   private Structurer prepareStructurer(boolean allowXml) {
     DispatcherBean config = new DispatcherBean();
+    config.setStaxHelper(new StAX());
     config.setAllowXmlProperties(allowXml);
     config.setResolver(new ClassPathResolver());
     config.setContractUriPrefix("/org/apache/forrest/dispatcher/");



Mime
View raw message