[jboss-svn-commits] JBL Code SVN: r14017 - labs/jbossesb/trunk/product/samples/quickstarts/tests/src/org/jboss/soa/esb/quickstart/test.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Aug 3 22:50:46 EDT 2007


Author: ldimaggi at redhat.com
Date: 2007-08-03 22:50:46 -0400 (Fri, 03 Aug 2007)
New Revision: 14017

Modified:
   labs/jbossesb/trunk/product/samples/quickstarts/tests/src/org/jboss/soa/esb/quickstart/test/RecipientlistTest.java
Log:
Enhanced to validate test results - need to figure out a way to deal with messages that contain XML - as org.jboss.soa.esb.actions.SystemPrintln action results in this error:  Content is not allowed in trailing section.



Modified: labs/jbossesb/trunk/product/samples/quickstarts/tests/src/org/jboss/soa/esb/quickstart/test/RecipientlistTest.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/tests/src/org/jboss/soa/esb/quickstart/test/RecipientlistTest.java	2007-08-04 02:36:31 UTC (rev 14016)
+++ labs/jbossesb/trunk/product/samples/quickstarts/tests/src/org/jboss/soa/esb/quickstart/test/RecipientlistTest.java	2007-08-04 02:50:46 UTC (rev 14017)
@@ -1,10 +1,13 @@
 package org.jboss.soa.esb.quickstart.test;
 
+import java.io.File;
 import java.io.OutputStream;
 import java.io.PrintStream;
 import java.net.URL;
 import java.net.URLConnection;
 import java.util.Date;
+import java.util.Hashtable;
+import java.io.File;
 
 import javax.management.ObjectName;
 import junit.framework.Test;
@@ -15,62 +18,65 @@
 import org.jboss.soa.esb.samples.quickstart.recipientList.test.*;
 import org.jboss.soa.esb.samples.quickstart.recipientList.*;
 
+import org.jboss.soa.esb.quickstart.test.Helpers;
+
 /**
  * Sample client for the jboss container.
- *
+ * 
  * @author <a href="mailto:"></a>
  * @version $Id: $
  */
 
-public class RecipientlistTest
-        extends JBossTestCase
-{
-	private static final String JMS_MESSAGE = "FOOBAResbmessage";
-
-        private static final String JMS_CBR_MESSAGE = "<Order sampleData=\"CBR wiretap test\" testDate=\"20070518\" routeToFollow=\"both\"><Customer userName=\"user1\" firstName=\"Harry\" lastName=\"Fletcher\" state=\"SD\"/></Order>";
-
-
-	public RecipientlistTest(String name)
-	{
+public class RecipientlistTest extends JBossTestCase {
+	private static final String JMS_MESSAGE = "RecipientlistTest message";
+	private static final String LOG_FILE = "/tmp/RecipientlistTest.log";
+	private static final String JMS_CBR_MESSAGE = "<Order sampleData=\"CBR wiretap test\" testDate=\"20070518\" routeToFollow=\"both\"><Customer userName=\"user1\" firstName=\"Harry\" lastName=\"Fletcher\" state=\"SD\"/></Order>";
+	
+	public RecipientlistTest(String name) {
 		super(name);
 	}
 
-	public void testMessage() throws Exception
-	{
-		sendMessage();
+	public void skip_testCBRMessage() throws Exception {
+		sendCBRJMSMessage();
 		Thread.sleep(10000); // wait for message to post.
-                sendStaticRouterJMSMessage();
-                Thread.sleep(10000); // wait for message to post.
-                sendCBRJMSMessage();
-                Thread.sleep(10000); // wait for message to post.
 	}
 
-	public void sendMessage() throws Exception
-	{
-    	SendJMSMessage sm = new SendJMSMessage();
-    	sm.setupConnection();
-    	sm.sendAMessage(JMS_MESSAGE);
-        sm.stop();
-        }
+	public void testStaticMessage() throws Exception {
+		sendStaticRouterJMSMessage();
+		Thread.sleep(10000); // wait for message to post.
+		
+		Hashtable theTable = Helpers.getMessageString(LOG_FILE);
 
-        public void sendCBRJMSMessage() throws Exception
-        {
-        SendCBRJMSMessage sm = new SendCBRJMSMessage();
-        sm.setupConnection();
-        sm.sendAMessage(JMS_CBR_MESSAGE);
-        sm.stop();
-        }
+		String theMessage1 = (String) theTable.get("Message1");
+		String theMessage2 = (String) theTable.get("Message2");
+		String theMessage3 = (String) theTable.get("Message3");
+		
+		assertEquals("The strings should match", theMessage1, JMS_MESSAGE);
+		assertEquals("The strings should match", theMessage2, JMS_MESSAGE);
+		assertEquals("The strings should match", theMessage3, JMS_MESSAGE);
+		
+		File target = new File(LOG_FILE);
+		target.delete();
+	}
 
-        public void sendStaticRouterJMSMessage() throws Exception
-        {
-        SendStaticRouterJMSMessage sm = new SendStaticRouterJMSMessage();
-        sm.setupConnection();
-        sm.sendAMessage(JMS_MESSAGE);
-        sm.stop();
-        }
+	public void sendCBRJMSMessage() throws Exception {
+		SendCBRJMSMessage sm = new SendCBRJMSMessage();
+		sm.setupConnection();
+		sm.sendAMessage(JMS_CBR_MESSAGE + Helpers.START_TAG + LOG_FILE
+				+ Helpers.END_TAG);
+		sm.stop();
+	}
 
-   public static Test suite() throws Exception
-   {
-      return getDeploySetup(RecipientlistTest.class, "Quickstart_recipient_list.esb");
-   }
+	public void sendStaticRouterJMSMessage() throws Exception {
+		SendStaticRouterJMSMessage sm = new SendStaticRouterJMSMessage();
+		sm.setupConnection();
+		sm.sendAMessage(JMS_MESSAGE + Helpers.START_TAG + LOG_FILE
+				+ Helpers.END_TAG);
+		sm.stop();
+	}
+
+	public static Test suite() throws Exception {
+		return getDeploySetup(RecipientlistTest.class,
+				"Quickstart_recipient_list.esb");
+	}
 }




More information about the jboss-svn-commits mailing list