[jboss-svn-commits] JBL Code SVN: r6549 - in labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb: actions actions/converters listeners
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Oct 3 09:53:30 EDT 2006
Author: mark.little at jboss.com
Date: 2006-10-03 09:53:15 -0400 (Tue, 03 Oct 2006)
New Revision: 6549
Added:
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/ByteArrayToStringUnitTest.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/FileToByteArrayUnitTest.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/LongToDateConverter.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/ObjectToCSVStringUnitTest.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/ObjectToFileWriterUnitTest.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/ObjectToXStreamUnitTest.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/StringToLongConverter.java
Removed:
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ByteArrayToStringUnitTest.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/FileToByteArrayUnitTest.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/LongToDateConverter.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ObjectToCSVStringUnitTest.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ObjectToFileWriterUnitTest.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ObjectToXStreamUnitTest.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/StringToLongConverter.java
Modified:
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/GpListener-Config-01.xml
Log:
http://jira.jboss.com/jira/browse/JBESB-152
Deleted: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ByteArrayToStringUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ByteArrayToStringUnitTest.java 2006-10-03 13:46:32 UTC (rev 6548)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ByteArrayToStringUnitTest.java 2006-10-03 13:53:15 UTC (rev 6549)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY 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 along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.actions;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.jboss.soa.esb.helpers.KeyValuePair;
-
-/**
- * ByteArrayToString unit tests.
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- * @since Version 4.0
- */
-public class ByteArrayToStringUnitTest extends TestCase {
-
- public void test() throws ActionProcessingException {
- List<KeyValuePair> properties = new ArrayList<KeyValuePair>();
-
- properties.add(new KeyValuePair("encoding", "UTF-8"));
- ByteArrayToString byteArrayToString = new ByteArrayToString("actionName", properties);
-
- String decodedBytes = (String)byteArrayToString.process("TestString".getBytes());
- assertEquals("TestString", decodedBytes);
- }
-}
Deleted: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/FileToByteArrayUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/FileToByteArrayUnitTest.java 2006-10-03 13:46:32 UTC (rev 6548)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/FileToByteArrayUnitTest.java 2006-10-03 13:53:15 UTC (rev 6549)
@@ -1,64 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY 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 along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.actions;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-
-import junit.framework.TestCase;
-
-/**
- * FileToByteArray unit tests.
- *
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- * @since Version 4.0
- */
-public class FileToByteArrayUnitTest extends TestCase {
-
- private File testFile = null;
- private String FILE_CONTENTS = "this is the file contents!";
-
- @Override
- protected void setUp() throws Exception {
- testFile = new File("FileToByteArrayUnitTest.tst");
-
- FileWriter fileWriter = new FileWriter(testFile);
-
- fileWriter.write(FILE_CONTENTS);
- fileWriter.flush();
- fileWriter.close();
- }
-
- @Override
- protected void tearDown() throws Exception {
- testFile.delete();
- }
-
- public void test() throws IOException, ActionProcessingException {
- FileToByteArray fileToByteArray = new FileToByteArray();
- byte[] fileContent = (byte[])fileToByteArray.process(testFile);
-
- assertEquals(FILE_CONTENTS, new String(fileContent));
- }
-}
Deleted: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/LongToDateConverter.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/LongToDateConverter.java 2006-10-03 13:46:32 UTC (rev 6548)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/LongToDateConverter.java 2006-10-03 13:53:15 UTC (rev 6549)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY 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 along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.actions;
-
-import java.util.Date;
-
-/**
- * LongToDate Converter Test Action Handler.
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- * @since Version 4.0
- */
-public class LongToDateConverter extends BaseTestActionProcessor {
-
- /* (non-Javadoc)
- * @see org.jboss.soa.esb.actions.ActionProcessor#processAction(java.lang.Object)
- */
- public Object process(Object payload) throws ActionProcessingException {
- if(!(payload instanceof Long)) {
- throw new ActionProcessingException("This action handler only accepts Long object instances.");
- }
- System.out.println("LongToDateConverter");
-
- return new Date((Long)payload);
- }
-}
Deleted: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ObjectToCSVStringUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ObjectToCSVStringUnitTest.java 2006-10-03 13:46:32 UTC (rev 6548)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ObjectToCSVStringUnitTest.java 2006-10-03 13:53:15 UTC (rev 6549)
@@ -1,74 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY 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 along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.actions;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.helpers.KeyValuePair;
-
-/**
- * ObjectToCSVString unit tests.
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- * @since Version 4.0
- */
-public class ObjectToCSVStringUnitTest extends TestCase {
-
- public void test() throws ConfigurationException, ActionProcessingException {
- List<KeyValuePair> properties = new ArrayList<KeyValuePair>();
-
- properties.add(new KeyValuePair(ObjectToCSVString.BEAN_PROPERTIES_PROP, "name"));
- ObjectToCSVString processor = new ObjectToCSVString("ObjectToCSVString", properties);
- assertEquals("Tom Fennelly", processor.process(new TestBean()));
-
- properties.clear();
- properties.add(new KeyValuePair(ObjectToCSVString.BEAN_PROPERTIES_PROP, "name,age"));
- processor = new ObjectToCSVString("ObjectToCSVString", properties);
- assertEquals("Tom Fennelly,21", processor.process(new TestBean()));
-
- properties.clear();
- properties.add(new KeyValuePair(ObjectToCSVString.BEAN_PROPERTIES_PROP, "id,name,phone,age"));
- processor = new ObjectToCSVString("ObjectToCSVString", properties);
- assertEquals(",Tom Fennelly,,21", processor.process(new TestBean()));
-
- properties.clear();
- properties.add(new KeyValuePair(ObjectToCSVString.BEAN_PROPERTIES_PROP, "id"));
- processor = new ObjectToCSVString("ObjectToCSVString", properties);
- assertEquals("", processor.process(new TestBean()));
- }
-
- private class TestBean {
- private String name = "Tom Fennelly";
- private int age = 21; // hehehehe
-
- public int getAge() {
- return age;
- }
- public String getName() {
- return name;
- }
- }
-}
Deleted: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ObjectToFileWriterUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ObjectToFileWriterUnitTest.java 2006-10-03 13:46:32 UTC (rev 6548)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ObjectToFileWriterUnitTest.java 2006-10-03 13:53:15 UTC (rev 6549)
@@ -1,96 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY 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 along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.actions;
-
-import java.io.File;
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.helpers.KeyValuePair;
-
-/**
- * Unit tests for ObjectToFileWriter.
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- * @since Version 4.0
- */
-public class ObjectToFileWriterUnitTest extends TestCase {
-
- private static final String A_STRING = "write something to file";
- private File file = new File("./ObjectToFileWriter.tst");
- private List<KeyValuePair> properties;
-
- @Override
- protected void setUp() throws Exception {
- properties = new ArrayList<KeyValuePair>();
- }
-
- @Override
- protected void tearDown() throws Exception {
- file.delete();
- }
-
- public void test_writeWithNoAppend() throws ConfigurationException, ActionProcessingException {
- properties.add(new KeyValuePair("file", file.getPath()));
-
- // Write something fo file and check it was written..
- writeAndCheck(A_STRING, A_STRING);
- // And do it all again to make sure the contents are not appended i.e. the file is overwritten...
- writeAndCheck(A_STRING, A_STRING);
- }
-
- public void test_writeWithBytes() throws ConfigurationException, ActionProcessingException, UnsupportedEncodingException {
- properties.add(new KeyValuePair("file", file.getPath()));
-
- // Write bytes to the file...
- writeAndCheck(A_STRING.getBytes("UTF-8"), A_STRING);
- }
-
- public void test_writeWithAppend() throws ConfigurationException, ActionProcessingException {
- properties.add(new KeyValuePair("file", file.getPath()));
- properties.add(new KeyValuePair("append", "true"));
-
- // Write something to file and check it was written..
- writeAndCheck(A_STRING, A_STRING);
- // And do it all again to make sure the contents are appended i.e. the file is not overwritten...
- writeAndCheck(A_STRING, A_STRING + A_STRING);
- }
-
-
- private void writeAndCheck(Object objectToWrite, String expected) throws ConfigurationException, ActionProcessingException {
- // Use the ObjectToFileWriter to write something to file...
- ObjectToFileWriter fileWriter = new ObjectToFileWriter("ObjectToFileWriter-Test", properties);
- fileWriter.process(objectToWrite);
-
- // Use the FileToByteArray processor to read the file contents back...
- FileToByteArray fileToByteArray = new FileToByteArray();
- byte[] fileContent = (byte[])fileToByteArray.process(file);
-
- // Make sure the contents are as expected...
- String fileContentString = new String(fileContent);
- assertEquals(expected, fileContentString);
- }
-}
Deleted: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ObjectToXStreamUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ObjectToXStreamUnitTest.java 2006-10-03 13:46:32 UTC (rev 6548)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ObjectToXStreamUnitTest.java 2006-10-03 13:53:15 UTC (rev 6549)
@@ -1,110 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY 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 along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.actions;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.jboss.soa.esb.helpers.KeyValuePair;
-
-import com.thoughtworks.xstream.XStream;
-import com.thoughtworks.xstream.io.xml.DomDriver;
-
-/**
- * ObjectToXStream unit tests.
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- * @since Version 4.0
- */
-public class ObjectToXStreamUnitTest extends TestCase {
-
- public void test_default() throws ActionProcessingException {
- List<KeyValuePair> properties = new ArrayList<KeyValuePair>();
-
- ObjectToXStream objectToXStream = new ObjectToXStream("TestBean-Serialiser", properties);
-
- String xml = (String)objectToXStream.process(new TestBean("Tom", "1234"));
- XStream xstream = new XStream(new DomDriver());
- TestBean bean = new TestBean();
-
- assertTrue("Expected [<TestBean>]. Got [" + xml + "]", xml.startsWith("<TestBean>"));
- xstream.alias("TestBean", TestBean.class);
- xstream.fromXML(xml, bean);
-
- assertEquals("Tom", bean.getName());
- assertEquals("1234", bean.getPhone());
- }
-
- public void test_with_package() throws ActionProcessingException {
- List<KeyValuePair> properties = new ArrayList<KeyValuePair>();
-
- properties.add(new KeyValuePair("exclude-package", "false"));
- ObjectToXStream objectToXStream = new ObjectToXStream("TestBean-Serialiser", properties);
-
- String xml = (String)objectToXStream.process(new TestBean("Tom", "1234"));
- XStream xstream = new XStream(new DomDriver());
- TestBean bean = new TestBean();
-
- assertTrue("Expected start with [<" + TestBean.class.getName() + ">]. Got [" + xml + "]", xml.startsWith("<" + TestBean.class.getName() + ">"));
- xstream.fromXML(xml, bean);
-
- assertEquals("Tom", bean.getName());
- assertEquals("1234", bean.getPhone());
- }
-
- public void test_with_alias() throws ActionProcessingException {
- List<KeyValuePair> properties = new ArrayList<KeyValuePair>();
-
- properties.add(new KeyValuePair("class-alias", "TomsClass"));
- ObjectToXStream objectToXStream = new ObjectToXStream("TestBean-Serialiser", properties);
-
- String xml = (String)objectToXStream.process(new TestBean("Tom", "1234"));
- XStream xstream = new XStream(new DomDriver());
- xstream.alias("TomsClass", TestBean.class);
- TestBean bean = new TestBean();
-
- assertTrue("Expected start with [<TomsClass>]. Got [" + xml + "]", xml.startsWith("<TomsClass>"));
- xstream.fromXML(xml, bean);
-
- assertEquals("Tom", bean.getName());
- assertEquals("1234", bean.getPhone());
- }
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Deleted: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/StringToLongConverter.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/StringToLongConverter.java 2006-10-03 13:46:32 UTC (rev 6548)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/StringToLongConverter.java 2006-10-03 13:53:15 UTC (rev 6549)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY 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 along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.soa.esb.actions;
-
-/**
- * StringToLong Converter Test Action Handler.
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- * @since Version 4.0
- */
-public class StringToLongConverter extends BaseTestActionProcessor {
-
- /* (non-Javadoc)
- * @see org.jboss.soa.esb.actions.ActionProcessor#processAction(java.lang.Object)
- */
- public Object process(Object payload) throws ActionProcessingException {
- if(!(payload instanceof String)) {
- throw new ActionProcessingException("This action handler only accepts String object instances.");
- }
-
- System.out.println("StringToLongConverter");
-
- return Long.parseLong((String)payload);
- }
-}
Copied: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/ByteArrayToStringUnitTest.java (from rev 6540, labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ByteArrayToStringUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ByteArrayToStringUnitTest.java 2006-10-03 08:07:46 UTC (rev 6540)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/ByteArrayToStringUnitTest.java 2006-10-03 13:53:15 UTC (rev 6549)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.actions.converters;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.actions.converters.ByteArrayToString;
+import org.jboss.soa.esb.helpers.KeyValuePair;
+
+import junit.framework.TestCase;
+
+/**
+ * ByteArrayToString unit tests.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ * @since Version 4.0
+ */
+public class ByteArrayToStringUnitTest extends TestCase
+{
+
+ public void test() throws ActionProcessingException
+ {
+ List<KeyValuePair> properties = new ArrayList<KeyValuePair>();
+
+ properties.add(new KeyValuePair("encoding", "UTF-8"));
+ ByteArrayToString byteArrayToString = new ByteArrayToString(
+ "actionName", properties);
+
+ String decodedBytes = (String) byteArrayToString.process("TestString"
+ .getBytes());
+ assertEquals("TestString", decodedBytes);
+ }
+}
Copied: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/FileToByteArrayUnitTest.java (from rev 6540, labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/FileToByteArrayUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/FileToByteArrayUnitTest.java 2006-10-03 08:07:46 UTC (rev 6540)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/FileToByteArrayUnitTest.java 2006-10-03 13:53:15 UTC (rev 6549)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.actions.converters;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.actions.converters.FileToByteArray;
+
+import junit.framework.TestCase;
+
+/**
+ * FileToByteArray unit tests.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ * @since Version 4.0
+ */
+public class FileToByteArrayUnitTest extends TestCase {
+
+ private File testFile = null;
+ private String FILE_CONTENTS = "this is the file contents!";
+
+ @Override
+ protected void setUp() throws Exception {
+ testFile = new File("FileToByteArrayUnitTest.tst");
+
+ FileWriter fileWriter = new FileWriter(testFile);
+
+ fileWriter.write(FILE_CONTENTS);
+ fileWriter.flush();
+ fileWriter.close();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ testFile.delete();
+ }
+
+ public void test() throws IOException, ActionProcessingException {
+ FileToByteArray fileToByteArray = new FileToByteArray();
+ byte[] fileContent = (byte[])fileToByteArray.process(testFile);
+
+ assertEquals(FILE_CONTENTS, new String(fileContent));
+ }
+}
Copied: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/LongToDateConverter.java (from rev 6540, labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/LongToDateConverter.java)
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/LongToDateConverter.java 2006-10-03 08:07:46 UTC (rev 6540)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/LongToDateConverter.java 2006-10-03 13:53:15 UTC (rev 6549)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.actions.converters;
+
+import java.util.Date;
+
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.actions.BaseTestActionProcessor;
+
+/**
+ * LongToDate Converter Test Action Handler.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ * @since Version 4.0
+ */
+public class LongToDateConverter extends BaseTestActionProcessor
+{
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.soa.esb.actions.ActionProcessor#processAction(java.lang.Object)
+ */
+ public Object process(Object payload) throws ActionProcessingException
+ {
+ if (!(payload instanceof Long))
+ {
+ throw new ActionProcessingException(
+ "This action handler only accepts Long object instances.");
+ }
+ System.out.println("LongToDateConverter");
+
+ return new Date((Long) payload);
+ }
+}
Copied: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/ObjectToCSVStringUnitTest.java (from rev 6540, labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ObjectToCSVStringUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ObjectToCSVStringUnitTest.java 2006-10-03 08:07:46 UTC (rev 6540)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/ObjectToCSVStringUnitTest.java 2006-10-03 13:53:15 UTC (rev 6549)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.actions.converters;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.actions.converters.ObjectToCSVString;
+import org.jboss.soa.esb.helpers.KeyValuePair;
+
+import junit.framework.TestCase;
+
+/**
+ * ObjectToCSVString unit tests.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ * @since Version 4.0
+ */
+public class ObjectToCSVStringUnitTest extends TestCase {
+
+ public void test() throws ConfigurationException, ActionProcessingException {
+ List<KeyValuePair> properties = new ArrayList<KeyValuePair>();
+
+ properties.add(new KeyValuePair(ObjectToCSVString.BEAN_PROPERTIES_PROP, "name"));
+ ObjectToCSVString processor = new ObjectToCSVString("ObjectToCSVString", properties);
+ assertEquals("Tom Fennelly", processor.process(new TestBean()));
+
+ properties.clear();
+ properties.add(new KeyValuePair(ObjectToCSVString.BEAN_PROPERTIES_PROP, "name,age"));
+ processor = new ObjectToCSVString("ObjectToCSVString", properties);
+ assertEquals("Tom Fennelly,21", processor.process(new TestBean()));
+
+ properties.clear();
+ properties.add(new KeyValuePair(ObjectToCSVString.BEAN_PROPERTIES_PROP, "id,name,phone,age"));
+ processor = new ObjectToCSVString("ObjectToCSVString", properties);
+ assertEquals(",Tom Fennelly,,21", processor.process(new TestBean()));
+
+ properties.clear();
+ properties.add(new KeyValuePair(ObjectToCSVString.BEAN_PROPERTIES_PROP, "id"));
+ processor = new ObjectToCSVString("ObjectToCSVString", properties);
+ assertEquals("", processor.process(new TestBean()));
+ }
+
+ private class TestBean {
+ private String name = "Tom Fennelly";
+ private int age = 21; // hehehehe
+
+ public int getAge() {
+ return age;
+ }
+ public String getName() {
+ return name;
+ }
+ }
+}
Copied: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/ObjectToFileWriterUnitTest.java (from rev 6540, labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ObjectToFileWriterUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ObjectToFileWriterUnitTest.java 2006-10-03 08:07:46 UTC (rev 6540)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/ObjectToFileWriterUnitTest.java 2006-10-03 13:53:15 UTC (rev 6549)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.actions.converters;
+
+import java.io.File;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.actions.converters.FileToByteArray;
+import org.jboss.soa.esb.actions.routing.ObjectToFileWriter;
+import org.jboss.soa.esb.helpers.KeyValuePair;
+
+import junit.framework.TestCase;
+
+/**
+ * Unit tests for ObjectToFileWriter.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ * @since Version 4.0
+ */
+public class ObjectToFileWriterUnitTest extends TestCase {
+
+ private static final String A_STRING = "write something to file";
+ private File file = new File("./ObjectToFileWriter.tst");
+ private List<KeyValuePair> properties;
+
+ @Override
+ protected void setUp() throws Exception {
+ properties = new ArrayList<KeyValuePair>();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ file.delete();
+ }
+
+ public void test_writeWithNoAppend() throws ConfigurationException, ActionProcessingException {
+ properties.add(new KeyValuePair("file", file.getPath()));
+
+ // Write something fo file and check it was written..
+ writeAndCheck(A_STRING, A_STRING);
+ // And do it all again to make sure the contents are not appended i.e. the file is overwritten...
+ writeAndCheck(A_STRING, A_STRING);
+ }
+
+ public void test_writeWithBytes() throws ConfigurationException, ActionProcessingException, UnsupportedEncodingException {
+ properties.add(new KeyValuePair("file", file.getPath()));
+
+ // Write bytes to the file...
+ writeAndCheck(A_STRING.getBytes("UTF-8"), A_STRING);
+ }
+
+ public void test_writeWithAppend() throws ConfigurationException, ActionProcessingException {
+ properties.add(new KeyValuePair("file", file.getPath()));
+ properties.add(new KeyValuePair("append", "true"));
+
+ // Write something to file and check it was written..
+ writeAndCheck(A_STRING, A_STRING);
+ // And do it all again to make sure the contents are appended i.e. the file is not overwritten...
+ writeAndCheck(A_STRING, A_STRING + A_STRING);
+ }
+
+
+ private void writeAndCheck(Object objectToWrite, String expected) throws ConfigurationException, ActionProcessingException {
+ // Use the ObjectToFileWriter to write something to file...
+ ObjectToFileWriter fileWriter = new ObjectToFileWriter("ObjectToFileWriter-Test", properties);
+ fileWriter.process(objectToWrite);
+
+ // Use the FileToByteArray processor to read the file contents back...
+ FileToByteArray fileToByteArray = new FileToByteArray();
+ byte[] fileContent = (byte[])fileToByteArray.process(file);
+
+ // Make sure the contents are as expected...
+ String fileContentString = new String(fileContent);
+ assertEquals(expected, fileContentString);
+ }
+}
Copied: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/ObjectToXStreamUnitTest.java (from rev 6540, labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ObjectToXStreamUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ObjectToXStreamUnitTest.java 2006-10-03 08:07:46 UTC (rev 6540)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/ObjectToXStreamUnitTest.java 2006-10-03 13:53:15 UTC (rev 6549)
@@ -0,0 +1,113 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.actions.converters;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.actions.TestBean;
+import org.jboss.soa.esb.actions.converters.ObjectToXStream;
+import org.jboss.soa.esb.helpers.KeyValuePair;
+
+import com.thoughtworks.xstream.XStream;
+import com.thoughtworks.xstream.io.xml.DomDriver;
+
+import junit.framework.TestCase;
+
+/**
+ * ObjectToXStream unit tests.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ * @since Version 4.0
+ */
+public class ObjectToXStreamUnitTest extends TestCase {
+
+ public void test_default() throws ActionProcessingException {
+ List<KeyValuePair> properties = new ArrayList<KeyValuePair>();
+
+ ObjectToXStream objectToXStream = new ObjectToXStream("TestBean-Serialiser", properties);
+
+ String xml = (String)objectToXStream.process(new TestBean("Tom", "1234"));
+ XStream xstream = new XStream(new DomDriver());
+ TestBean bean = new TestBean();
+
+ assertTrue("Expected [<TestBean>]. Got [" + xml + "]", xml.startsWith("<TestBean>"));
+ xstream.alias("TestBean", TestBean.class);
+ xstream.fromXML(xml, bean);
+
+ assertEquals("Tom", bean.getName());
+ assertEquals("1234", bean.getPhone());
+ }
+
+ public void test_with_package() throws ActionProcessingException {
+ List<KeyValuePair> properties = new ArrayList<KeyValuePair>();
+
+ properties.add(new KeyValuePair("exclude-package", "false"));
+ ObjectToXStream objectToXStream = new ObjectToXStream("TestBean-Serialiser", properties);
+
+ String xml = (String)objectToXStream.process(new TestBean("Tom", "1234"));
+ XStream xstream = new XStream(new DomDriver());
+ TestBean bean = new TestBean();
+
+ assertTrue("Expected start with [<" + TestBean.class.getName() + ">]. Got [" + xml + "]", xml.startsWith("<" + TestBean.class.getName() + ">"));
+ xstream.fromXML(xml, bean);
+
+ assertEquals("Tom", bean.getName());
+ assertEquals("1234", bean.getPhone());
+ }
+
+ public void test_with_alias() throws ActionProcessingException {
+ List<KeyValuePair> properties = new ArrayList<KeyValuePair>();
+
+ properties.add(new KeyValuePair("class-alias", "TomsClass"));
+ ObjectToXStream objectToXStream = new ObjectToXStream("TestBean-Serialiser", properties);
+
+ String xml = (String)objectToXStream.process(new TestBean("Tom", "1234"));
+ XStream xstream = new XStream(new DomDriver());
+ xstream.alias("TomsClass", TestBean.class);
+ TestBean bean = new TestBean();
+
+ assertTrue("Expected start with [<TomsClass>]. Got [" + xml + "]", xml.startsWith("<TomsClass>"));
+ xstream.fromXML(xml, bean);
+
+ assertEquals("Tom", bean.getName());
+ assertEquals("1234", bean.getPhone());
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Copied: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/StringToLongConverter.java (from rev 6540, labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/StringToLongConverter.java)
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/StringToLongConverter.java 2006-10-03 08:07:46 UTC (rev 6540)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/StringToLongConverter.java 2006-10-03 13:53:15 UTC (rev 6549)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.actions.converters;
+
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.actions.BaseTestActionProcessor;
+
+/**
+ * StringToLong Converter Test Action Handler.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ * @since Version 4.0
+ */
+public class StringToLongConverter extends BaseTestActionProcessor {
+
+ /* (non-Javadoc)
+ * @see org.jboss.soa.esb.actions.ActionProcessor#processAction(java.lang.Object)
+ */
+ public Object process(Object payload) throws ActionProcessingException {
+ if(!(payload instanceof String)) {
+ throw new ActionProcessingException("This action handler only accepts String object instances.");
+ }
+
+ System.out.println("StringToLongConverter");
+
+ return Long.parseLong((String)payload);
+ }
+}
Modified: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/GpListener-Config-01.xml
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/GpListener-Config-01.xml 2006-10-03 13:46:32 UTC (rev 6548)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/GpListener-Config-01.xml 2006-10-03 13:53:15 UTC (rev 6549)
@@ -22,8 +22,8 @@
<!--
Under the new architecture I think these will be equivalent to "Services"? The alias "name" being like the Service URN.
-->
- <Alias name="StringToLongConverter" class="org.jboss.soa.esb.actions.StringToLongConverter" />
- <Alias name="LongToDateConverter" class="org.jboss.soa.esb.actions.LongToDateConverter" />
+ <Alias name="StringToLongConverter" class="org.jboss.soa.esb.actions.converters.StringToLongConverter" />
+ <Alias name="LongToDateConverter" class="org.jboss.soa.esb.actions.converters.LongToDateConverter" />
<Alias name="ToNowhereRouter" class="org.jboss.soa.esb.actions.ToNowhereRouter" />
</ProcessorAliases>
</Actions>
More information about the jboss-svn-commits
mailing list