[jboss-cvs] JBoss Messaging SVN: r3142 - in trunk/tests/src/org/jboss/test/messaging: tools/container and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Sep 26 15:23:42 EDT 2007


Author: ataylor
Date: 2007-09-26 15:23:42 -0400 (Wed, 26 Sep 2007)
New Revision: 3142

Modified:
   trunk/tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java
   trunk/tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
   trunk/tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java
   trunk/tests/src/org/jboss/test/messaging/tools/container/Server.java
Log:
"http://jira.jboss.com/jira/browse/JBMESSAGING-1078 - adding testcases

Modified: trunk/tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java	2007-09-26 19:22:42 UTC (rev 3141)
+++ trunk/tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java	2007-09-26 19:23:42 UTC (rev 3142)
@@ -36,9 +36,15 @@
 import javax.jms.TopicConnection;
 import javax.jms.TopicSession;
 import javax.naming.InitialContext;
+import javax.management.ObjectName;
 
 import org.jboss.test.messaging.jms.message.SimpleJMSBytesMessage;
 import org.jboss.test.messaging.jms.message.SimpleJMSMessage;
+import org.jboss.test.messaging.jms.message.SimpleJMSTextMessage;
+import org.jboss.test.messaging.tools.container.ServiceAttributeOverrides;
+import org.jboss.test.messaging.tools.container.ServiceContainer;
+import org.jboss.test.messaging.tools.ServerManagement;
+import org.jboss.jms.client.JBossConnectionFactory;
 
 /**
  * Safeguards for previously detected TCK failures.
@@ -56,18 +62,76 @@
    // Static --------------------------------------------------------
 
    // Attributes ----------------------------------------------------
+   protected static JBossConnectionFactory cf;
+   protected ServiceAttributeOverrides overrides;
+    private static final String ORG_JBOSS_MESSAGING_SERVICE_LBCONNECTION_FACTORY = "org.jboss.messaging:service=StrictTckConnectionFactory";
 
-   protected InitialContext ic;
+    // Constructors --------------------------------------------------
 
-   // Constructors --------------------------------------------------
-
    public CTSMiscellaneousTest(String name)
    {
       super(name);
    }
 
-   // Public --------------------------------------------------------
+    protected void setUp() throws Exception
+    {
+        try
+        {
+            super.setUp();
+            //Deploy a connection factory with load balancing but no failover on node0
+            ServerManagement.getServer(0).deployConnectionFactory(ORG_JBOSS_MESSAGING_SERVICE_LBCONNECTION_FACTORY,
+                                                        new String[] { "/StrictTCKConnectionFactory" }, true);
+            cf = (JBossConnectionFactory) ic.lookup("/StrictTCKConnectionFactory");
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
 
+    }
+
+    // Public --------------------------------------------------------
+
+   public void testForiengMessageSetDestination() throws Exception
+   {
+      Connection c = null;
+
+      try
+      {
+	      c = cf.createConnection();
+	      Session s = c.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+	      MessageProducer p = s.createProducer(queue1);
+
+	      // create a Bytes foreign message
+	      SimpleJMSTextMessage txt = new SimpleJMSTextMessage("hello from Brazil!");
+         txt.setJMSDestination(null);
+
+         p.send(txt);
+
+         assertNotNull(txt.getJMSDestination());
+
+         MessageConsumer cons = s.createConsumer(queue1);
+	     c.start();
+
+	     TextMessage tm = (TextMessage)cons.receive();
+	     assertNotNull(tm);
+         assertEquals("hello from Brazil!", txt.getText());
+      }
+      catch(Exception e)
+      {
+          e.printStackTrace();
+      }
+      finally
+      {
+      	if (c != null)
+      	{
+      		c.close();
+      	}
+      }
+
+   }
+
    public void testForeignByteMessage() throws Exception
    {
       Connection c = null;
@@ -231,8 +295,13 @@
       }
    }
 
+    protected void tearDown() throws Exception
+    {
+        super.tearDown();
+        ServerManagement.undeployConnectionFactory(new ObjectName(ORG_JBOSS_MESSAGING_SERVICE_LBCONNECTION_FACTORY));
+    }
 
-   // Package protected ---------------------------------------------
+    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------
    

Modified: trunk/tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java	2007-09-26 19:22:42 UTC (rev 3141)
+++ trunk/tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java	2007-09-26 19:23:42 UTC (rev 3142)
@@ -709,16 +709,22 @@
                                        String[] jndiBindings,
                                        int prefetchSize) throws Exception
    {
-      deployConnectionFactory(objectName, jndiBindings, prefetchSize, -1, -1, -1, false, false);
+      deployConnectionFactory(objectName, jndiBindings, prefetchSize, -1, -1, -1, false, false, false);
    }
 
    public void deployConnectionFactory(String objectName,
                                        String[] jndiBindings) throws Exception
    {
-      deployConnectionFactory(objectName, jndiBindings, -1, -1, -1, -1, false, false);
+      deployConnectionFactory(objectName, jndiBindings, -1, -1, -1, -1, false, false, false);
    }
-   
-   public void deployConnectionFactory(String objectName,
+
+
+    public void deployConnectionFactory(String objectName, String[] jndiBindings, boolean strictTck)  throws Exception
+    {
+        deployConnectionFactory(objectName, jndiBindings, -1, -1, -1, -1, false, false, strictTck);
+    }
+
+    public void deployConnectionFactory(String objectName,
          String[] jndiBindings,
          int prefetchSize,
          int defaultTempQueueFullSize,
@@ -726,7 +732,7 @@
          int defaultTempQueueDownCacheSize) throws Exception
    {
    	this.deployConnectionFactory(objectName, jndiBindings, prefetchSize, defaultTempQueueFullSize,
-   			defaultTempQueuePageSize, defaultTempQueueDownCacheSize, false, false);   			
+   			defaultTempQueuePageSize, defaultTempQueueDownCacheSize, false, false, false);
    }
    
    public void deployConnectionFactory(String objectName,
@@ -734,7 +740,7 @@
          boolean supportsFailover, boolean supportsLoadBalancing) throws Exception
    {
    	this.deployConnectionFactory(objectName, jndiBindings, -1, -1,
-   			-1, -1, supportsFailover, supportsLoadBalancing);   			
+   			-1, -1, supportsFailover, supportsLoadBalancing, false);
    }
 
    private void deployConnectionFactory(String objectName,
@@ -744,7 +750,8 @@
                                        int defaultTempQueuePageSize,
                                        int defaultTempQueueDownCacheSize,
                                        boolean supportsFailover,
-                                       boolean supportsLoadBalancing) throws Exception
+                                       boolean supportsLoadBalancing,
+                                       boolean strictTck) throws Exception
    {
       log.trace("deploying connection factory with name: " + objectName);
       
@@ -778,7 +785,7 @@
       
       config += "<attribute name=\"SupportsFailover\">" + supportsFailover + "</attribute>";
       config += "<attribute name=\"SupportsLoadBalancing\">" + supportsLoadBalancing + "</attribute>";
-
+      config += "<attribute name=\"StrictTck\">" + strictTck + "</attribute>";
       if (jndiBindings != null)
       {
 	      config += "<attribute name=\"JNDIBindings\"><bindings>";

Modified: trunk/tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java	2007-09-26 19:22:42 UTC (rev 3141)
+++ trunk/tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java	2007-09-26 19:23:42 UTC (rev 3142)
@@ -402,7 +402,14 @@
       server.deployConnectionFactory(objectName, jndiBindings, prefetchSize);
    }
 
-   public void deployConnectionFactory(String objectName,
+
+    public void deployConnectionFactory(String objectName, String[] jndiBindings, boolean strictTck) throws Exception
+    {
+        server.deployConnectionFactory(objectName, jndiBindings, strictTck);
+
+    }
+
+    public void deployConnectionFactory(String objectName,
                                        String[] jndiBindings,
                                        int prefetchSize,
                                        int defaultTempQueueFullSize,

Modified: trunk/tests/src/org/jboss/test/messaging/tools/container/Server.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/container/Server.java	2007-09-26 19:22:42 UTC (rev 3141)
+++ trunk/tests/src/org/jboss/test/messaging/tools/container/Server.java	2007-09-26 19:23:42 UTC (rev 3142)
@@ -290,4 +290,6 @@
    void resetAllSuckers() throws Exception;   
    
    void reapMessages() throws Exception;
+
+    void deployConnectionFactory(String objectName, String[] jndiBindings, boolean strictTck) throws Exception;
 }




More information about the jboss-cvs-commits mailing list