[jboss-svn-commits] JBL Code SVN: r11007 - labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/tests.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Apr 16 10:09:57 EDT 2007
Author: mark.little at jboss.com
Date: 2007-04-16 10:09:57 -0400 (Mon, 16 Apr 2007)
New Revision: 11007
Added:
labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/tests/DefaultFtpReplyToEprIntegrationTest.java
Removed:
labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/tests/DefaultFtpReplyToEprUnitTest.java
Log:
Copied: labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/tests/DefaultFtpReplyToEprIntegrationTest.java (from rev 11001, labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/tests/DefaultFtpReplyToEprUnitTest.java)
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/tests/DefaultFtpReplyToEprIntegrationTest.java (rev 0)
+++ labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/tests/DefaultFtpReplyToEprIntegrationTest.java 2007-04-16 14:09:57 UTC (rev 11007)
@@ -0,0 +1,143 @@
+/*
+ * 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.addressing.eprs.tests;
+
+import static org.junit.Assert.assertTrue;
+import junit.framework.JUnit4TestAdapter;
+
+import org.apache.log4j.Logger;
+import org.jboss.internal.soa.esb.couriers.PickUpOnlyCourier;
+import org.jboss.soa.esb.addressing.eprs.FTPEpr;
+import org.jboss.soa.esb.common.tests.BaseTest;
+import org.jboss.soa.esb.couriers.CourierFactory;
+import org.jboss.soa.esb.couriers.CourierUtil;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Unit tests for default reply to
+ *
+ * @author <a href="mailto:schifest at heuristica.com.ar">Esteban</a>
+ */
+
+
+public class DefaultFtpReplyToEprIntegrationTest extends BaseTest
+{
+
+ private static Class thisClass = DefaultFtpReplyToEprIntegrationTest.class;
+ static Logger _logger = Logger.getLogger(thisClass);
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(thisClass);
+ }
+
+ @BeforeClass
+ public static void runBeforeAllTests()
+ {
+ _logger.info("@BeforeClass invoked");
+ }
+
+
+ @AfterClass
+ public static void runAfterAllTests() throws Exception
+ {
+ _logger.info("_________________________________________");
+ _logger.info("@AfterClass invoked");
+ }
+
+
+ @Test
+ public void mockTest() {
+ _logger.info("place holder");
+ assertTrue(true);
+ }
+
+
+ // uncomment the following line when ftpUrl has the proper value
+// @Test
+ public void testFTPEpr()
+ {
+ String ftpUrl = null;
+
+ if (getFtpPwd() != null)
+ ftpUrl = "ftp://" + getFtpUser() + ":" + getFtpPwd()+ "@" + getFtpHostname() + getFtpDir();
+ else
+ ftpUrl = "ftp://" + getFtpUser() + "@" + getFtpHostname() + getFtpDir();
+
+ _logger.info("_________________________________________");
+ _logger.info("testFTPEpr() invoked");
+ try
+ {
+ String initialSuffix = ".ftpmsg";
+
+ // Send a Message that will be picked up by a listener, and specify replyTo
+ FTPEpr toEpr = new FTPEpr(ftpUrl);
+ toEpr.setInputSuffix(initialSuffix);
+ toEpr.setPostDelete(true);
+ toEpr.setPostSuffix(initialSuffix);
+ FTPEpr replyToEpr = (FTPEpr)CourierUtil.getDefaultReplyToEpr(toEpr);
+
+ String text_1 = "Outgoing";
+ Message outgoingMsg = MessageFactory.getInstance().getMessage();
+ outgoingMsg.getHeader().getCall().setTo(toEpr);
+ outgoingMsg.getHeader().getCall().setReplyTo(replyToEpr);
+ outgoingMsg.getBody().setContents(text_1.getBytes());
+ CourierUtil.deliverMessage(outgoingMsg);
+
+ // Mock a service that picks up the original message and replies
+ FTPEpr serviceEpr = new FTPEpr(toEpr.getURL());
+ serviceEpr.setInputSuffix(initialSuffix);
+ serviceEpr.setPostDelete(true);
+ PickUpOnlyCourier listener = CourierFactory.getPickupCourier(serviceEpr);
+ Message received = listener.pickup(100);
+ String text_2 = new String(received.getBody().getContents());
+ assertTrue(text_1.equals(text_2));
+ assertTrue(replyToEpr.equals(received.getHeader().getCall().getReplyTo()));
+
+ // now respond to replyTo
+ text_2 += " + processed by listener";
+ Message response = MessageFactory.getInstance().getMessage();
+ response.getHeader().getCall().setTo(received.getHeader().getCall().getReplyTo());
+ response.getBody().setContents(text_2.getBytes());
+ CourierUtil.deliverMessage(response);
+
+ // try to pick up reply
+ PickUpOnlyCourier waiter = CourierFactory.getPickupCourier(replyToEpr);
+ Message finalMsg = waiter.pickup(100);
+ assertTrue(text_2.equals(new String(finalMsg.getBody().getContents())));
+
+ _logger.info(text_2+"... and back from FTP server");
+ _logger.info("getDefaultReplyToEpr test succeeded for FTP transport");
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+}
\ No newline at end of file
Deleted: labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/tests/DefaultFtpReplyToEprUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/tests/DefaultFtpReplyToEprUnitTest.java 2007-04-16 13:46:43 UTC (rev 11006)
+++ labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/tests/DefaultFtpReplyToEprUnitTest.java 2007-04-16 14:09:57 UTC (rev 11007)
@@ -1,137 +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.addressing.eprs.tests;
-
-import static org.junit.Assert.assertTrue;
-import junit.framework.JUnit4TestAdapter;
-
-import org.apache.log4j.Logger;
-import org.jboss.internal.soa.esb.couriers.PickUpOnlyCourier;
-import org.jboss.soa.esb.addressing.eprs.FTPEpr;
-import org.jboss.soa.esb.couriers.CourierFactory;
-import org.jboss.soa.esb.couriers.CourierUtil;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Unit tests for default reply to
- *
- * @author <a href="mailto:schifest at heuristica.com.ar">Esteban</a>
- */
-
-
-public class DefaultFtpReplyToEprUnitTest
-{
-
- private static Class thisClass = DefaultFtpReplyToEprUnitTest.class;
- static Logger _logger = Logger.getLogger(thisClass);
-
- public static junit.framework.Test suite()
- {
- return new JUnit4TestAdapter(thisClass);
- }
-
- @BeforeClass
- public static void runBeforeAllTests()
- {
- _logger.info("@BeforeClass invoked");
- }
-
-
- @AfterClass
- public static void runAfterAllTests() throws Exception
- {
- _logger.info("_________________________________________");
- _logger.info("@AfterClass invoked");
- }
-
-
- @Test
- public void mockTest() {
- _logger.info("place holder");
- assertTrue(true);
- }
-
-
- // uncomment the following line when ftpUrl has the proper value
-// @Test
- public void testFTPEpr()
- {
- String ftpUrl = "ftp://ftpuser:ftppassword@localhost:/tmp";
-
- _logger.info("_________________________________________");
- _logger.info("testFTPEpr() invoked");
- try
- {
- String initialSuffix = ".ftpmsg";
-
- // Send a Message that will be picked up by a listener, and specify replyTo
- FTPEpr toEpr = new FTPEpr(ftpUrl);
- toEpr.setInputSuffix(initialSuffix);
- toEpr.setPostDelete(true);
- toEpr.setPostSuffix(initialSuffix);
- FTPEpr replyToEpr = (FTPEpr)CourierUtil.getDefaultReplyToEpr(toEpr);
-
- String text_1 = "Outgoing";
- Message outgoingMsg = MessageFactory.getInstance().getMessage();
- outgoingMsg.getHeader().getCall().setTo(toEpr);
- outgoingMsg.getHeader().getCall().setReplyTo(replyToEpr);
- outgoingMsg.getBody().setContents(text_1.getBytes());
- CourierUtil.deliverMessage(outgoingMsg);
-
- // Mock a service that picks up the original message and replies
- FTPEpr serviceEpr = new FTPEpr(toEpr.getURL());
- serviceEpr.setInputSuffix(initialSuffix);
- serviceEpr.setPostDelete(true);
- PickUpOnlyCourier listener = CourierFactory.getPickupCourier(serviceEpr);
- Message received = listener.pickup(100);
- String text_2 = new String(received.getBody().getContents());
- assertTrue(text_1.equals(text_2));
- assertTrue(replyToEpr.equals(received.getHeader().getCall().getReplyTo()));
-
- // now respond to replyTo
- text_2 += " + processed by listener";
- Message response = MessageFactory.getInstance().getMessage();
- response.getHeader().getCall().setTo(received.getHeader().getCall().getReplyTo());
- response.getBody().setContents(text_2.getBytes());
- CourierUtil.deliverMessage(response);
-
- // try to pick up reply
- PickUpOnlyCourier waiter = CourierFactory.getPickupCourier(replyToEpr);
- Message finalMsg = waiter.pickup(100);
- assertTrue(text_2.equals(new String(finalMsg.getBody().getContents())));
-
- _logger.info(text_2+"... and back from FTP server");
- _logger.info("getDefaultReplyToEpr test succeeded for FTP transport");
-
- }
- catch (Exception e)
- {
- e.printStackTrace();
- assertTrue(false);
- }
- }
-
-}
\ No newline at end of file
More information about the jboss-svn-commits
mailing list