Author: tfennelly
Date: 2010-06-06 05:25:50 -0400 (Sun, 06 Jun 2010)
New Revision: 22586
Added:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/SmooksModelBuilder.java
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/core/Param.java
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/core/Params.java
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/SmooksModelTestCase.java
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/core/
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/core/ParamsTest.java
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/core/v1_1/
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/core/v1_1/config-01.xml
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/core/v1_1/config-02.xml
Modified:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/SmooksModel.java
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/core/v1.1.ftl
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/core/v1.1.xml
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/csv/CSVReader_1_2_Test.java
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/csv/CSVReader_1_3_Test.java
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/csv/v1_2/csv-config-01.xml
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/csv/v1_2/csv-config-04.xml
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/csv/v1_3/csv-config-04.xml
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/javabean/BeanTest.java
Log:
Added model for <params>
Modified:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/SmooksModel.java
===================================================================
---
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/SmooksModel.java 2010-06-05
15:11:38 UTC (rev 22585)
+++
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/SmooksModel.java 2010-06-06
09:25:50 UTC (rev 22586)
@@ -20,9 +20,12 @@
package org.jboss.tools.smooks.model;
import org.jboss.tools.smooks.model.core.Component;
+import org.jboss.tools.smooks.model.core.Params;
import org.jboss.tools.smooks.model.core.Reader;
+import org.milyn.javabean.dynamic.Model;
import org.milyn.javabean.dynamic.serialize.DefaultNamespace;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
@@ -36,10 +39,19 @@
public static final String MODEL_DESCRIPTOR =
"org/jboss/tools/smooks/model/descriptor.properties";
+ private Params params;
private List<Reader> readers = new ArrayList<Reader>();
private List<Component> components = new ArrayList<Component>();
- public List<Reader> getReaders() {
+ public Params getParams() {
+ return params;
+ }
+
+ public void setParams(Params params) {
+ this.params = params;
+ }
+
+ public List<Reader> getReaders() {
return readers;
}
Added:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/SmooksModelBuilder.java
===================================================================
---
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/SmooksModelBuilder.java
(rev 0)
+++
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/SmooksModelBuilder.java 2010-06-06
09:25:50 UTC (rev 22586)
@@ -0,0 +1,56 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009, JBoss Inc.
+ */
+package org.jboss.tools.smooks.model;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+
+import org.milyn.javabean.dynamic.Model;
+import org.milyn.javabean.dynamic.ModelBuilder;
+import org.xml.sax.SAXException;
+
+/**
+ * {@link SmooksModel} Builder.
+ * <p/>
+ * Simple wrapper for the {@link ModelBuilder}.
+ *
+ * @author <a
href="mailto:tom.fennelly@jboss.com">tom.fennelly@jboss.com</a>
+ */
+public class SmooksModelBuilder {
+
+ private ModelBuilder modelBuilder;
+
+ public SmooksModelBuilder() throws SAXException, IOException {
+ modelBuilder = new ModelBuilder(SmooksModel.MODEL_DESCRIPTOR, false);
+ }
+
+ public ModelBuilder getModelBuilder() {
+ return modelBuilder;
+ }
+
+ public Model<SmooksModel> readModel(InputStream configStream) throws SAXException,
IOException {
+ return modelBuilder.readModel(configStream, SmooksModel.class);
+ }
+
+ public Model<SmooksModel> readModel(Reader configStream) throws SAXException,
IOException {
+ return modelBuilder.readModel(configStream, SmooksModel.class);
+ }
+}
Property changes on:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/SmooksModelBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/core/Param.java
===================================================================
---
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/core/Param.java
(rev 0)
+++
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/core/Param.java 2010-06-06
09:25:50 UTC (rev 22586)
@@ -0,0 +1,49 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009, JBoss Inc.
+ */
+package org.jboss.tools.smooks.model.core;
+
+/**
+ * Param.
+ *
+ * @author <a
href="mailto:tom.fennelly@jboss.com">tom.fennelly@jboss.com</a>
+ */
+public class Param {
+
+ private String name;
+ private String value;
+
+ public String getName() {
+ return name;
+ }
+
+ public Param setName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public Param setValue(String value) {
+ this.value = value;
+ return this;
+ }
+}
Property changes on:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/core/Param.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/core/Params.java
===================================================================
---
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/core/Params.java
(rev 0)
+++
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/core/Params.java 2010-06-06
09:25:50 UTC (rev 22586)
@@ -0,0 +1,107 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009, JBoss Inc.
+ */
+package org.jboss.tools.smooks.model.core;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.milyn.StreamFilterType;
+import org.milyn.delivery.Filter;
+
+/**
+ * Params.
+ *
+ * @author <a
href="mailto:tom.fennelly@jboss.com">tom.fennelly@jboss.com</a>
+ */
+public class Params {
+
+ private List<Param> params;
+
+ public List<Param> getParams() {
+ return params;
+ }
+
+ public void setParams(List<Param> params) {
+ this.params = params;
+ }
+
+ public String getParam(String name) {
+ if(params == null) {
+ return null;
+ }
+
+ for(Param param : params) {
+ String paramName = param.getName();
+ if(paramName != null && paramName.equals(name)) {
+ return param.getValue();
+ }
+ }
+
+ return null;
+ }
+
+ public Params setParam(String name, String value) {
+ if(params == null) {
+ params = new ArrayList<Param>();
+ }
+
+ removeParam(name);
+ params.add(new Param().setName(name).setValue(value));
+ return this;
+ }
+
+ public Params removeParam(String name) {
+ if(params == null) {
+ return this;
+ }
+
+ Iterator<Param> paramsIterator = params.iterator();
+
+ while(paramsIterator.hasNext()) {
+ String paramName = paramsIterator.next().getName();
+ if(paramName != null && paramName.equals(name)) {
+ paramsIterator.remove();
+ return this;
+ }
+ }
+
+ return this;
+ }
+
+ public Params setFilterType(StreamFilterType filterType) {
+ setParam(Filter.STREAM_FILTER_TYPE, filterType.toString());
+ return this;
+ }
+
+ public StreamFilterType getFilterType() {
+ String filterType = getParam(Filter.STREAM_FILTER_TYPE);
+
+ if(filterType == null) {
+ return null;
+ }
+
+ try {
+ return StreamFilterType.valueOf(filterType);
+ } catch(Exception e) {
+ return null;
+ }
+ }
+}
Property changes on:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/core/Params.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/core/v1.1.ftl
===================================================================
---
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/core/v1.1.ftl 2010-06-05
15:11:38 UTC (rev 22585)
+++
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/core/v1.1.ftl 2010-06-06
09:25:50 UTC (rev 22586)
@@ -1,6 +1,13 @@
<?xml version="1.0"?>
<smooks-resource-list <@writeNamespaces indent="22"/>>
+<#if bean.params??>
+ <params>
+ <#list bean.params.params as param>
+ <param name="${param.name}">${param.value}</param>
+ </#list>
+ </params>
+</#if>
<#list bean.readers as reader><@writeBean bean=reader /></#list>
<#list bean.components as component><@writeBean bean=component
/></#list>
Modified:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/core/v1.1.xml
===================================================================
---
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/core/v1.1.xml 2010-06-05
15:11:38 UTC (rev 22585)
+++
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.model/src/org/jboss/tools/smooks/model/core/v1.1.xml 2010-06-06
09:25:50 UTC (rev 22586)
@@ -7,6 +7,7 @@
Main Smooks model bean.
-->
<jb:bean beanId="smooksModel"
class="org.jboss.tools.smooks.model.SmooksModel"
createOnElement="#document">
+ <jb:wiring property="params" beanIdRef="params" />
<jb:wiring property="readers" beanIdRef="readers" />
<jb:wiring property="components" beanIdRef="components"
/>
</jb:bean>
@@ -17,6 +18,18 @@
<jb:wiring beanType="org.jboss.tools.smooks.model.core.Component"
/>
</jb:bean>
+ <!-- params -->
+ <jb:bean beanId="params"
class="org.jboss.tools.smooks.model.core.Params"
createOnElement="/smooks-resource-list/params">
+ <jb:wiring property="params" beanIdRef="paramsList" />
+ </jb:bean>
+ <jb:bean beanId="paramsList" class="java.util.ArrayList"
createOnElement="/smooks-resource-list/params">
+ <jb:wiring beanIdRef="param" />
+ </jb:bean>
+ <jb:bean beanId="param"
class="org.jboss.tools.smooks.model.core.Param"
createOnElement="/smooks-resource-list/params/param">
+ <jb:value property="name"
data="/smooks-resource-list/params/param/@name" />
+ <jb:value property="value"
data="/smooks-resource-list/params/param" />
+ </jb:bean>
+
<!--
Top level writer...
-->
Added:
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/SmooksModelTestCase.java
===================================================================
---
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/SmooksModelTestCase.java
(rev 0)
+++
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/SmooksModelTestCase.java 2010-06-06
09:25:50 UTC (rev 22586)
@@ -0,0 +1,70 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009, JBoss Inc.
+ */
+package org.jboss.tools.smooks.model;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import org.custommonkey.xmlunit.XMLAssert;
+import org.custommonkey.xmlunit.XMLUnit;
+import org.jboss.tools.smooks.model.SmooksModel;
+import org.jboss.tools.smooks.model.SmooksModelBuilder;
+import org.milyn.javabean.dynamic.Model;
+import org.xml.sax.SAXException;
+
+import junit.framework.TestCase;
+
+/**
+ * Abstract SmooksModel test case.
+ *
+ * @author <a
href="mailto:tom.fennelly@jboss.com">tom.fennelly@jboss.com</a>
+ */
+public abstract class SmooksModelTestCase extends TestCase {
+
+ protected SmooksModelBuilder smooksModelBuilder;
+
+ public SmooksModelTestCase() throws IOException, SAXException {
+ smooksModelBuilder = new SmooksModelBuilder();
+ }
+
+ public SmooksModelBuilder getSmooksModelBuilder() {
+ return smooksModelBuilder;
+ }
+
+ public void setReportPath(String reportPath) {
+ smooksModelBuilder.getModelBuilder().setReportPath(reportPath);
+ }
+
+ public Model<SmooksModel> test(String messageFile) throws IOException,
SAXException {
+ Model<SmooksModel> model =
smooksModelBuilder.readModel(getClass().getResourceAsStream(messageFile));
+ assertModelEquals(model, messageFile);
+ return model;
+ }
+
+ public void assertModelEquals(Model<SmooksModel> model, String messageFile) throws
IOException, SAXException {
+ StringWriter modelWriter = new StringWriter();
+ model.writeModel(modelWriter);
+ System.out.println(modelWriter);
+ XMLUnit.setIgnoreWhitespace( true );
+ XMLAssert.assertXMLEqual(new
InputStreamReader(getClass().getResourceAsStream(messageFile)), new
StringReader(modelWriter.toString()));
+ }
+}
\ No newline at end of file
Property changes on:
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/SmooksModelTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/core/ParamsTest.java
===================================================================
---
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/core/ParamsTest.java
(rev 0)
+++
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/core/ParamsTest.java 2010-06-06
09:25:50 UTC (rev 22586)
@@ -0,0 +1,74 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009, JBoss Inc.
+ */
+package org.jboss.tools.smooks.model.core;
+
+import org.jboss.tools.smooks.model.SmooksModel;
+import org.jboss.tools.smooks.model.SmooksModelTestCase;
+import org.milyn.StreamFilterType;
+import org.milyn.javabean.dynamic.Model;
+import org.xml.sax.SAXException;
+
+import java.io.IOException;
+
+/**
+ * @author <a
href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
+ */
+public class ParamsTest extends SmooksModelTestCase {
+
+ public ParamsTest() throws IOException, SAXException {
+ super();
+ }
+
+ public void test_manual() {
+ Params params = new Params();
+ assertEquals(null, params.getParam("a"));
+ params.removeParam("a"); // make sure there's no exception
+ params.setParam("a", "aVal");
+ assertEquals("aVal", params.getParam("a"));
+ params.setParam("a", "bVal");
+ assertEquals("bVal", params.getParam("a"));
+ params.setFilterType(StreamFilterType.SAX);
+ assertTrue(params.getFilterType() == StreamFilterType.SAX);
+ params.setFilterType(StreamFilterType.DOM);
+ assertTrue(params.getFilterType() == StreamFilterType.DOM);
+ }
+
+ public void test_config_v11_01() throws IOException, SAXException {
+ Model<SmooksModel> model = test("v1_1/config-01.xml");
+
+ Params params = model.getModelRoot().getParams();
+
+ assertTrue(params.getFilterType() == StreamFilterType.SAX);
+
+ params.setFilterType(StreamFilterType.DOM);
+ assertModelEquals(model, "v1_1/config-02.xml");
+ }
+
+ public void test_config_v11_02() throws IOException, SAXException {
+ Model<SmooksModel> model = test("v1_1/config-02.xml");
+
+ Params params = model.getModelRoot().getParams();
+
+ assertTrue(params.getFilterType() == StreamFilterType.DOM);
+
+ params.setFilterType(StreamFilterType.SAX);
+ assertModelEquals(model, "v1_1/config-01.xml");
+ }
+}
\ No newline at end of file
Property changes on:
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/core/ParamsTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/core/v1_1/config-01.xml
===================================================================
---
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/core/v1_1/config-01.xml
(rev 0)
+++
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/core/v1_1/config-01.xml 2010-06-06
09:25:50 UTC (rev 22586)
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<smooks-resource-list
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd">
+
+ <params>
+ <param name="a">aVal</param>
+ <param name="b">bVal</param>
+ <param name="stream.filter.type">SAX</param>
+ </params>
+
+</smooks-resource-list>
\ No newline at end of file
Property changes on:
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/core/v1_1/config-01.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/core/v1_1/config-02.xml
===================================================================
---
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/core/v1_1/config-02.xml
(rev 0)
+++
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/core/v1_1/config-02.xml 2010-06-06
09:25:50 UTC (rev 22586)
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<smooks-resource-list
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd">
+
+ <params>
+ <param name="a">aVal</param>
+ <param name="b">bVal</param>
+ <param name="stream.filter.type">DOM</param>
+ </params>
+
+</smooks-resource-list>
\ No newline at end of file
Property changes on:
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/core/v1_1/config-02.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/csv/CSVReader_1_2_Test.java
===================================================================
---
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/csv/CSVReader_1_2_Test.java 2010-06-05
15:11:38 UTC (rev 22585)
+++
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/csv/CSVReader_1_2_Test.java 2010-06-06
09:25:50 UTC (rev 22586)
@@ -19,12 +19,11 @@
*/
package org.jboss.tools.smooks.model.csv;
-import junit.framework.TestCase;
import org.custommonkey.xmlunit.XMLAssert;
import org.custommonkey.xmlunit.XMLUnit;
import org.jboss.tools.smooks.model.SmooksModel;
+import org.jboss.tools.smooks.model.SmooksModelTestCase;
import org.milyn.javabean.dynamic.Model;
-import org.milyn.javabean.dynamic.ModelBuilder;
import org.xml.sax.SAXException;
import java.io.IOException;
@@ -35,12 +34,10 @@
/**
* @author <a
href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
*/
-public class CSVReader_1_2_Test extends TestCase {
+public class CSVReader_1_2_Test extends SmooksModelTestCase {
- private ModelBuilder modelBuilder;
-
public CSVReader_1_2_Test() throws IOException, SAXException {
- modelBuilder = new ModelBuilder(SmooksModel.MODEL_DESCRIPTOR, false);
+ super();
}
public void test_01() throws IOException, SAXException {
@@ -59,19 +56,9 @@
test("v1_2/csv-config-04.xml");
}
- public void test(String messageFile) throws IOException, SAXException {
- Model<SmooksModel> model =
modelBuilder.readModel(getClass().getResourceAsStream(messageFile), SmooksModel.class);
-
- StringWriter modelWriter = new StringWriter();
- model.writeModel(modelWriter);
-// System.out.println(modelWriter);
- XMLUnit.setIgnoreWhitespace( true );
- XMLAssert.assertXMLEqual(new
InputStreamReader(getClass().getResourceAsStream(messageFile)), new
StringReader(modelWriter.toString()));
- }
-
public void test_programmatic_build() throws IOException, SAXException {
SmooksModel smooksModel = new SmooksModel();
- Model<SmooksModel> model = new Model<SmooksModel>(smooksModel,
modelBuilder);
+ Model<SmooksModel> model = new Model<SmooksModel>(smooksModel,
getSmooksModelBuilder().getModelBuilder());
CSVReader csvReader = new CSVReader();
// Populate it...
Modified:
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/csv/CSVReader_1_3_Test.java
===================================================================
---
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/csv/CSVReader_1_3_Test.java 2010-06-05
15:11:38 UTC (rev 22585)
+++
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/csv/CSVReader_1_3_Test.java 2010-06-06
09:25:50 UTC (rev 22586)
@@ -19,12 +19,11 @@
*/
package org.jboss.tools.smooks.model.csv;
-import junit.framework.TestCase;
import org.custommonkey.xmlunit.XMLAssert;
import org.custommonkey.xmlunit.XMLUnit;
import org.jboss.tools.smooks.model.SmooksModel;
+import org.jboss.tools.smooks.model.SmooksModelTestCase;
import org.milyn.javabean.dynamic.Model;
-import org.milyn.javabean.dynamic.ModelBuilder;
import org.xml.sax.SAXException;
import java.io.IOException;
@@ -35,12 +34,10 @@
/**
* @author <a
href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
*/
-public class CSVReader_1_3_Test extends TestCase {
+public class CSVReader_1_3_Test extends SmooksModelTestCase {
- private ModelBuilder modelBuilder;
-
public CSVReader_1_3_Test() throws IOException, SAXException {
- modelBuilder = new ModelBuilder(SmooksModel.MODEL_DESCRIPTOR, false);
+ super();
}
public void test_01() throws IOException, SAXException {
@@ -63,19 +60,9 @@
test("v1_3/csv-config-05.xml");
}
- public void test(String messageFile) throws IOException, SAXException {
- Model<SmooksModel> model =
modelBuilder.readModel(getClass().getResourceAsStream(messageFile), SmooksModel.class);
-
- StringWriter modelWriter = new StringWriter();
- model.writeModel(modelWriter);
-// System.out.println(modelWriter);
- XMLUnit.setIgnoreWhitespace( true );
- XMLAssert.assertXMLEqual(new
InputStreamReader(getClass().getResourceAsStream(messageFile)), new
StringReader(modelWriter.toString()));
- }
-
public void test_programmatic_build() throws IOException, SAXException {
SmooksModel smooksModel = new SmooksModel();
- Model<SmooksModel> model = new Model<SmooksModel>(smooksModel,
modelBuilder);
+ Model<SmooksModel> model = new Model<SmooksModel>(smooksModel,
getSmooksModelBuilder().getModelBuilder());
CSVReader csvReader = new CSVReader();
// Populate it...
Modified:
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/csv/v1_2/csv-config-01.xml
===================================================================
---
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/csv/v1_2/csv-config-01.xml 2010-06-05
15:11:38 UTC (rev 22585)
+++
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/csv/v1_2/csv-config-01.xml 2010-06-06
09:25:50 UTC (rev 22586)
@@ -2,6 +2,10 @@
<smooks-resource-list
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
xmlns:csv="http://www.milyn.org/xsd/smooks/csv-1.2.xsd">
+ <params>
+ <param name="stream.filter.type">SAX</param>
+ </params>
+
<csv:reader fields="name,address,age" rootElementName="people"
recordElementName="person" indent="true"/>
</smooks-resource-list>
\ No newline at end of file
Modified:
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/csv/v1_2/csv-config-04.xml
===================================================================
---
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/csv/v1_2/csv-config-04.xml 2010-06-05
15:11:38 UTC (rev 22585)
+++
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/csv/v1_2/csv-config-04.xml 2010-06-06
09:25:50 UTC (rev 22586)
@@ -2,6 +2,10 @@
<smooks-resource-list
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
xmlns:csv="http://www.milyn.org/xsd/smooks/csv-1.2.xsd">
+ <params>
+ <param name="stream.filter.type">DOM</param>
+ </params>
+
<!-- CSV Reader config... -->
<csv:reader fields="name,address,age" rootElementName="people"
recordElementName="person" indent="true">
<csv:mapBinding beanId="beanX" class="com.acme.XClass"
keyField="name" />
Modified:
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/csv/v1_3/csv-config-04.xml
===================================================================
---
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/csv/v1_3/csv-config-04.xml 2010-06-05
15:11:38 UTC (rev 22585)
+++
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/csv/v1_3/csv-config-04.xml 2010-06-06
09:25:50 UTC (rev 22586)
@@ -2,6 +2,10 @@
<smooks-resource-list
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
xmlns:csv="http://www.milyn.org/xsd/smooks/csv-1.3.xsd">
+ <params>
+ <param name="stream.filter.type">SAX</param>
+ </params>
+
<!-- CSV Reader config... -->
<csv:reader fields="name,address,age" rootElementName="people"
recordElementName="person" indent="true">
<csv:mapBinding beanId="beanX" class="com.acme.XClass"
keyField="name" />
Modified:
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/javabean/BeanTest.java
===================================================================
---
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/javabean/BeanTest.java 2010-06-05
15:11:38 UTC (rev 22585)
+++
workspace/smooks-dmb/smooks/tests/org.jboss.tools.smooks.model.test/src/org/jboss/tools/smooks/model/javabean/BeanTest.java 2010-06-06
09:25:50 UTC (rev 22586)
@@ -19,31 +19,21 @@
*/
package org.jboss.tools.smooks.model.javabean;
-import junit.framework.TestCase;
-import org.custommonkey.xmlunit.XMLAssert;
-import org.custommonkey.xmlunit.XMLUnit;
-import org.jboss.tools.smooks.model.SmooksModel;
-import org.milyn.javabean.dynamic.Model;
-import org.milyn.javabean.dynamic.ModelBuilder;
+import org.jboss.tools.smooks.model.SmooksModelTestCase;
import org.xml.sax.SAXException;
import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.StringReader;
-import java.io.StringWriter;
/**
* @author <a
href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
*/
-public class BeanTest extends TestCase {
+public class BeanTest extends SmooksModelTestCase {
- private ModelBuilder modelBuilder;
+ public BeanTest() throws IOException, SAXException {
+ super();
+ }
- public BeanTest() throws IOException, SAXException {
- modelBuilder = new ModelBuilder(SmooksModel.MODEL_DESCRIPTOR, false);
- }
-
- public void test_v11() throws IOException, SAXException {
+ public void test_v11() throws IOException, SAXException {
test("v1_1/config-01.xml");
}
@@ -64,14 +54,4 @@
// mixed namespaces...
test("v1_3/config-02.xml");
}
-
- public void test(String messageFile) throws IOException, SAXException {
- Model<SmooksModel> model =
modelBuilder.readModel(getClass().getResourceAsStream(messageFile), SmooksModel.class);
-
- StringWriter modelWriter = new StringWriter();
- model.writeModel(modelWriter);
- System.out.println(modelWriter);
- XMLUnit.setIgnoreWhitespace( true );
- XMLAssert.assertXMLEqual(new
InputStreamReader(getClass().getResourceAsStream(messageFile)), new
StringReader(modelWriter.toString()));
- }
}
\ No newline at end of file