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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jan 9 22:29:24 EST 2007


Author: clebert.suconic at jboss.com
Date: 2007-01-09 22:29:22 -0500 (Tue, 09 Jan 2007)
New Revision: 1939

Modified:
   trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java
   trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
Log:
http://jira.jboss.org/jira/browse/JBMESSAGING-711

Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java	2007-01-10 03:00:40 UTC (rev 1938)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java	2007-01-10 03:29:22 UTC (rev 1939)
@@ -1496,14 +1496,89 @@
 
    public void testSimpleFailover() throws Exception
    {
+      simpleFailover(null, null);
+   }
+
+   public void testSimpleFailoverUserPassword() throws Exception
+   {
+      final String testTopicConf =
+         "<security>" +
+            "<role name=\"guest\" read=\"true\" write=\"true\"/>" +
+            "<role name=\"publisher\" read=\"true\" write=\"true\" create=\"false\"/>" +
+            "<role name=\"durpublisher\" read=\"true\" write=\"true\" create=\"true\"/>" +
+         "</security>";
+
+      ServerManagement.configureSecurityForDestination(0, "testDistributedQueue", testTopicConf);
+      ServerManagement.configureSecurityForDestination(1, "testDistributedQueue", testTopicConf);
+
+      simpleFailover("john", "needle");
+   }
+
+//   public void testTemp() throws Exception
+//   {
+//      Connection conn = null;
+//
+//      try
+//      {
+//         conn = cf.createConnection();
+//         conn.close();
+//
+//         conn = cf.createConnection();
+//
+//         assertEquals(1, ((JBossConnection)conn).getServerID());
+//
+//         // we "cripple" the remoting connection by removing ConnectionListener. This way, failures
+//         // cannot be "cleanly" detected by the client-side pinger, and we'll fail on an invocation
+//         JMSRemotingConnection rc = ((ClientConnectionDelegate)((JBossConnection)conn).
+//            getDelegate()).getRemotingConnection();
+//         rc.removeConnectionListener();
+//
+//         ServerManagement.killAndWait(1);
+//
+//         log.info("########");
+//         log.info("######## KILLED NODE 1");
+//         log.info("########");
+//
+//         Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+//      }
+//      finally
+//      {
+//         if (conn != null)
+//         {
+//            conn.close();
+//         }
+//      }
+//   }
+
+   // Package protected ----------------------------------------------------------------------------
+
+   // Protected ------------------------------------------------------------------------------------
+
+   protected void simpleFailover(String userName, String password)
+      throws Exception
+   {
       Connection conn = null;
 
       try
       {
-         conn = cf.createConnection();
+         if (userName!=null)
+         {
+            conn = cf.createConnection(userName, password);
+         }
+         else
+         {
+            conn = cf.createConnection();
+         }
          conn.close();
 
-         conn = cf.createConnection();
+         if (userName!=null)
+         {
+            conn = cf.createConnection(userName, password);
+         }
+         else
+         {
+            conn = cf.createConnection();
+         }
          conn.start();
 
          // make sure we're connecting to node 1
@@ -1553,46 +1628,6 @@
       }
    }
 
-//   public void testTemp() throws Exception
-//   {
-//      Connection conn = null;
-//
-//      try
-//      {
-//         conn = cf.createConnection();
-//         conn.close();
-//
-//         conn = cf.createConnection();
-//
-//         assertEquals(1, ((JBossConnection)conn).getServerID());
-//
-//         // we "cripple" the remoting connection by removing ConnectionListener. This way, failures
-//         // cannot be "cleanly" detected by the client-side pinger, and we'll fail on an invocation
-//         JMSRemotingConnection rc = ((ClientConnectionDelegate)((JBossConnection)conn).
-//            getDelegate()).getRemotingConnection();
-//         rc.removeConnectionListener();
-//
-//         ServerManagement.killAndWait(1);
-//
-//         log.info("########");
-//         log.info("######## KILLED NODE 1");
-//         log.info("########");
-//
-//         Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-//      }
-//      finally
-//      {
-//         if (conn != null)
-//         {
-//            conn.close();
-//         }
-//      }
-//   }
-
-   // Package protected ----------------------------------------------------------------------------
-
-   // Protected ------------------------------------------------------------------------------------
-
    protected void setUp() throws Exception
    {
       nodeCount = 2;

Modified: trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java	2007-01-10 03:00:40 UTC (rev 1938)
+++ trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java	2007-01-10 03:29:22 UTC (rev 1939)
@@ -739,10 +739,16 @@
    public static void configureSecurityForDestination(String destName, String config)
       throws Exception
    {
-      insureStarted();
-      servers[0].getServer().configureSecurityForDestination(destName, config);
+      configureSecurityForDestination(0, destName, config);
    }
 
+   public static void configureSecurityForDestination(int serverId, String destName, String config)
+      throws Exception
+   {
+      insureStarted(serverId);
+      servers[serverId].getServer().configureSecurityForDestination(destName, config);
+   }
+
    public static void setDefaultSecurityConfig(String config) throws Exception
    {
       insureStarted();




More information about the jboss-cvs-commits mailing list