Author: thorsten
Date: Tue Oct 7 05:53:52 2008
New Revision: 702463
URL: http://svn.apache.org/viewvc?rev=702463&view=rev
Log:
FOR-1118
Using interface map instead a concret implementation (HashMap) where ever
possible
Modified:
forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/api/Contract.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/api/Contract.java
URL:
http://svn.apache.org/viewvc/forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/api/Contract.java?rev=702463&r1=702462&r2=702463&view=diff
==============================================================================
---
forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/api/Contract.java
(original)
+++
forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/api/Contract.java
Tue Oct 7 05:53:52 2008
@@ -17,7 +17,7 @@
package org.apache.forrest.dispatcher.api;
import java.io.InputStream;
-import java.util.HashMap;
+import java.util.Map;
import org.apache.forrest.dispatcher.exception.DispatcherException;
@@ -76,7 +76,7 @@
* properties.
* @throws DispatcherException
*/
- InputStream execute(InputStream dataStream, HashMap<String, ?> properties)
+ InputStream execute(InputStream dataStream, Map<String, Object> properties)
throws DispatcherException;
/**
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=702463&r1=702462&r2=702463&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
Tue Oct 7 05:53:52 2008
@@ -20,6 +20,7 @@
import java.io.InputStream;
import java.io.StringReader;
import java.util.HashMap;
+import java.util.Map;
import org.apache.forrest.dispatcher.api.Contract;
import org.apache.forrest.dispatcher.exception.DispatcherException;
@@ -36,14 +37,14 @@
InputStream xslStream = this.getClass().getResourceAsStream(CONTRACT_XML);
contract.initializeFromStream(xslStream);
// testing the transformation without parameters
- HashMap<String, String> properties = new HashMap<String, String>();
+ Map<String, Object> properties = new HashMap<String, Object>();
contract.execute(null, properties);
}
public void testContractWithParameter() throws DispatcherException,
FileNotFoundException {
Contract contract = new XSLContract(false);
InputStream xslStream = this.getClass().getResourceAsStream(CONTRACT_XML);
contract.initializeFromStream(xslStream);
- HashMap<String, String> properties = new HashMap<String, String>();
+ Map<String, Object> properties = new HashMap<String, Object>();
// testing the transformation with parameters
properties.put("test-inline", this.getClass().getCanonicalName());
contract.execute(null, properties);
@@ -52,7 +53,7 @@
Contract contract = new XSLContract(true);
InputStream xslStream = this.getClass().getResourceAsStream(CONTRACT_XML);
contract.initializeFromStream(xslStream);
- HashMap<String, InputSource> properties = new HashMap<String,
InputSource>();
+ Map<String, Object> properties = new HashMap<String, Object>();
// testing the transformation with parameters
String valueString =
"<class>"+this.getClass().getCanonicalName()+"</class>";
InputSource value = new InputSource(new StringReader(valueString));
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=702463&r1=702462&r2=702463&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
Tue Oct 7 05:53:52 2008
@@ -1,6 +1,7 @@
package org.apache.forrest.dispatcher;
import java.io.InputStream;
+import java.util.HashMap;
import org.apache.forrest.dispatcher.api.Structurer;
import org.apache.forrest.dispatcher.config.DispatcherBean;
@@ -18,7 +19,7 @@
Structurer structurer = prepareStructurer(false);
structurer.execute(getStream(), format);
}
-
+
public void testStructurerWithXmlProperties() throws DispatcherException {
String format = "html";
Structurer structurer = prepareStructurer(true);
@@ -36,7 +37,8 @@
config.setAllowXmlProperties(allowXml);
config.setResolver(new ClassPathResolver());
config.setContractUriPrefix("/org/apache/forrest/dispatcher/");
- Structurer structurer = new XMLStructurer(config);
+ HashMap <String,Object> map = new HashMap<String, Object>();
+ Structurer structurer = new XMLStructurer(config,map);
return structurer;
}
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=702463&r1=702462&r2=702463&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
Tue Oct 7 05:53:52 2008
@@ -1,6 +1,8 @@
package org.apache.forrest.dispatcher;
import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.forrest.dispatcher.api.Structurer;
import org.apache.forrest.dispatcher.config.DispatcherBean;
@@ -12,7 +14,7 @@
public class TestStructurerAXIOM extends TestCase {
private static final String STRUCTURER_XML =
"master.advanced.structurer.xml";
-
+
public void testStructurer() throws DispatcherException {
String format = "html";
Structurer structurer = prepareStructurer(false);
@@ -24,7 +26,7 @@
Structurer structurer = prepareStructurer(true);
structurer.execute(getStream(), format);
}
-
+
public void testStructurerFo() throws DispatcherException {
String format = "fo";
Structurer structurer = prepareStructurer(false);
@@ -36,13 +38,14 @@
Structurer structurer = prepareStructurer(false);
structurer.execute(getStream(), format);
}
-
+
private Structurer prepareStructurer(boolean allowXml) {
DispatcherBean config = new DispatcherBean();
config.setAllowXmlProperties(allowXml);
config.setResolver(new ClassPathResolver());
config.setContractUriPrefix("/org/apache/forrest/dispatcher/");
- Structurer structurer = new XMLStructurerAxiom(config);
+ Map<String, Object> properties = new HashMap<String, Object>();
+ Structurer structurer = new XMLStructurerAxiom(config,properties);
return structurer;
}