Package org.jboss.jms.server.connectionmanager

Examples of org.jboss.jms.server.connectionmanager.SimpleConnectionManager$ConnectionFactoryCallbackInformation


         messageIDManager = new IDManager("MESSAGE_ID", 4096, persistenceManager);
         channelIDManager = new IDManager("CHANNEL_ID", 10, persistenceManager);
         transactionIDManager = new IDManager("TRANSACTION_ID", 1024, persistenceManager);
         destinationJNDIMapper = new DestinationJNDIMapper(this);
         connFactoryJNDIMapper = new ConnectionFactoryJNDIMapper(this);
         connectionManager = new SimpleConnectionManager();
         connectorManager = new SimpleConnectorManager();
         memoryManager = new SimpleMemoryManager();
         messageStore = new SimpleMessageStore();
         txRepository =
            new TransactionRepository(persistenceManager, messageStore, transactionIDManager);
View Full Code Here


         // Create the wired components
         messageIDManager = new IDManager("MESSAGE_ID", 4096, persistenceManager);
         channelIDManager = new IDManager("CHANNEL_ID", 10, persistenceManager);
         destinationJNDIMapper = new DestinationJNDIMapper(this);
         connFactoryJNDIMapper = new ConnectionFactoryJNDIMapper(this);
         connectionManager = new SimpleConnectionManager();
         connectorManager = new SimpleConnectorManager();
         memoryManager = new SimpleMemoryManager();
         messageStore = new SimpleMessageStore();
         messageIDMgr = new RotatingID(serverPeerID);
         txRepository =
View Full Code Here

         // Create the wired components
         messageIDManager = new IDManager("MESSAGE_ID", 4096, persistenceManager);
         channelIDManager = new IDManager("CHANNEL_ID", 10, persistenceManager);
         destinationJNDIMapper = new DestinationJNDIMapper(this);
         connFactoryJNDIMapper = new ConnectionFactoryJNDIMapper(this);
         connectionManager = new SimpleConnectionManager();
         connectorManager = new SimpleConnectorManager();
         memoryManager = new SimpleMemoryManager();
         messageStore = new SimpleMessageStore();
         messageIDMgr = new RotatingID(serverPeerID);
         txRepository =
View Full Code Here

         conn2 = (JBossConnection)cf.createConnection();
         Session sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
        
         ServerPeer peer = ServerManagement.getServer().getServerPeer();
        
         SimpleConnectionManager cm = (SimpleConnectionManager)peer.getConnectionManager();
        
         //Simulate failure on connection
        
         Map jmsClients = cm.getClients();
         assertEquals(1, jmsClients.size());
        
         Map endpoints = (Map)jmsClients.values().iterator().next();
        
         assertEquals(2, endpoints.size());
        
         Iterator iter = endpoints.entrySet().iterator();
              
         Map.Entry entry = (Map.Entry)iter.next();
        
         String sessId1 = (String)entry.getKey();
         
         entry = (Map.Entry)iter.next();
        
         String sessId2 = (String)entry.getKey();
        
         //Simulate failure of connection
        
         cm.handleClientFailure(sessId1);
 
         jmsClients = cm.getClients();
         assertEquals(1, jmsClients.size());       
        
         cm.handleClientFailure(sessId2);
        
         jmsClients = cm.getClients();
         assertEquals(0, jmsClients.size());  
      }
      finally
      {
         if (conn1 != null)
View Full Code Here

  

   public void testCFWithMock() throws Exception
   {
      ServerPeer mockPeer = new ServerPeer();
      SimpleConnectionManager cm = new SimpleConnectionManager();
     
      // Instead of exposing setConnectionManager just for this test, we are doing this hack
      // to set the ConnectionManager
      Field  field = ServerPeer.class.getDeclaredField("connectionManager");
      field.setAccessible(true);
      field.set(mockPeer, cm);
     

      ServerConnectionFactoryEndpoint cfEnd1 = new ServerConnectionFactoryEndpoint("UName","UName",mockPeer,
            null,
            null,
            0,
            false,
            0,
            0,
            0,
            0,
            true);
      cm.registerConnectionFactory(cfEnd1);

      ServerConnectionFactoryEndpoint cfEnd2 = new ServerConnectionFactoryEndpoint("UName2","UName2",mockPeer,
            null,
            null,
            0,
            false,
            0,
            0,
            0,
            0,
            true);
      cm.registerConnectionFactory(cfEnd2);

      MockRemotingCallbackHandler session1Handler = new MockRemotingCallbackHandler();
      MockRemotingCallbackHandler session2Handler = new MockRemotingCallbackHandler();
      MockRemotingCallbackHandler session3Handler = new MockRemotingCallbackHandler();
      MockRemotingCallbackHandler session4Handler = new MockRemotingCallbackHandler();
     
      cm.registerConnectionFactoryCallback("VM1", "Session1", session1Handler);
      cm.registerConnectionFactoryCallback("VM1", "Session2", session2Handler);
      cm.registerConnectionFactoryCallback("VM2", "Session3", session3Handler);
      cm.registerConnectionFactoryCallback("VM4", "Session3", session3Handler);
     
      cfEnd1.addCallback("VM1", "Session1", session1Handler);
      cfEnd1.addCallback("VM1", "Session2", session2Handler);
      cfEnd2.addCallback("VM2", "Session3", session3Handler);
      cfEnd2.addCallback("VM2", "Session4", session4Handler);
     
     
      assertEquals(2, cfEnd1.getCallbackHandlers().size());
      assertEquals(2, cfEnd2.getCallbackHandlers().size());
     
      cm.handleClientFailure("Session1");
     
      assertEquals(1, cfEnd1.getCallbackHandlers().size());
      assertEquals(2, cfEnd2.getCallbackHandlers().size());
     
      cm.handleClientFailure("Session3");
      assertEquals(1, cfEnd1.getCallbackHandlers().size());
      assertEquals(1, cfEnd2.getCallbackHandlers().size());
     
      cm.handleClientFailure("Session2");
      assertEquals(0, cfEnd1.getCallbackHandlers().size());
      assertEquals(1, cfEnd2.getCallbackHandlers().size());
     
      cm.handleClientFailure("Session4");
      assertEquals(0, cfEnd1.getCallbackHandlers().size());
      assertEquals(0, cfEnd2.getCallbackHandlers().size());
   }
View Full Code Here

   }
  
  
   public void testWithMock() throws Exception
   {
      SimpleConnectionManager cm = new SimpleConnectionManager();

      SimpleConnectionEndpoint e1 = new SimpleConnectionEndpoint(cm, "jvm1", "sessionid1");
      SimpleConnectionEndpoint e2 = new SimpleConnectionEndpoint(cm, "jvm1", "sessionid2");
      SimpleConnectionEndpoint e3 = new SimpleConnectionEndpoint(cm, "jvm2", "sessionid3");
      SimpleConnectionEndpoint e4 = new SimpleConnectionEndpoint(cm, "jvm2", "sessionid4");
      SimpleConnectionEndpoint e5 = new SimpleConnectionEndpoint(cm, "jvm3", "sessionid5");
      SimpleConnectionEndpoint e6 = new SimpleConnectionEndpoint(cm, "jvm3", "sessionid6");

      assertFalse(e1.isClosed());
      assertFalse(e2.isClosed());
      assertFalse(e3.isClosed());
      assertFalse(e4.isClosed());
      assertFalse(e5.isClosed());
      assertFalse(e6.isClosed());

      cm.registerConnection("jvm1", "sessionid1", e1);
      cm.registerConnection("jvm1", "sessionid2", e2);
      cm.registerConnection("jvm2", "sessionid3", e3);
      cm.registerConnection("jvm2", "sessionid4", e4);
      cm.registerConnection("jvm3", "sessionid5", e5);
      cm.registerConnection("jvm3", "sessionid6", e6);

      assertTrue(cm.containsRemotingSession("sessionid1"));
      assertTrue(cm.containsRemotingSession("sessionid2"));
      assertTrue(cm.containsRemotingSession("sessionid3"));
      assertTrue(cm.containsRemotingSession("sessionid4"));
      assertTrue(cm.containsRemotingSession("sessionid5"));
      assertTrue(cm.containsRemotingSession("sessionid6"));

      ConnectionEndpoint r1 = cm.unregisterConnection("jvm3", "sessionid6");
      assertEquals(e6, r1);
      assertFalse(e6.isClosed());

      assertNull(cm.unregisterConnection("blah", "blah"));

      assertFalse(cm.containsRemotingSession("sessionid6"));

      ConnectionEndpoint r2 = cm.unregisterConnection("jvm3", "sessionid5");
      assertEquals(e5, r2);
      assertFalse(e5.isClosed());

      assertFalse(cm.containsRemotingSession("sessionid5"));

      cm.handleClientFailure("sessionid4");

      assertNull(cm.unregisterConnection("jvm2", "sessionid4"));
      ConnectionEndpoint r3 = cm.unregisterConnection("jvm2", "sessionid3");
      assertEquals(e3, r3);
      assertFalse(e3.isClosed());

      assertFalse(cm.containsRemotingSession("sessionid4"));
      assertFalse(cm.containsRemotingSession("sessionid3"));

      assertTrue(e4.isClosed());

      ConnectionEndpoint r4 = cm.unregisterConnection("jvm1", "sessionid1");
      assertEquals(e1, r4);
      assertFalse(e1.isClosed());

      ConnectionEndpoint r5 = cm.unregisterConnection("jvm1", "sessionid2");
      assertEquals(e2, r5);
      assertFalse(e2.isClosed());

      assertFalse(cm.containsRemotingSession("sessionid2"));
      assertFalse(cm.containsRemotingSession("sessionid1"));

   }
View Full Code Here

         // Create the wired components
         messageIDManager = new IDManager("MESSAGE_ID", 4096, persistenceManager);
         channelIDManager = new IDManager("CHANNEL_ID", 10, persistenceManager);
         destinationJNDIMapper = new DestinationJNDIMapper(this);
         connFactoryJNDIMapper = new ConnectionFactoryJNDIMapper(this);
         connectionManager = new SimpleConnectionManager();
         connectorManager = new SimpleConnectorManager();
         memoryManager = new SimpleMemoryManager();
         messageStore = new SimpleMessageStore();
         messageIDMgr = new RotatingID(serverPeerID);
         txRepository =
View Full Code Here

         messageIDManager = new IDManager("MESSAGE_ID", 4096, persistenceManager);
         channelIDManager = new IDManager("CHANNEL_ID", 10, persistenceManager);
         transactionIDManager = new IDManager("TRANSACTION_ID", 1024, persistenceManager);
         destinationJNDIMapper = new DestinationJNDIMapper(this);
         connFactoryJNDIMapper = new ConnectionFactoryJNDIMapper(this);
         connectionManager = new SimpleConnectionManager();        
         connectorManager = new SimpleConnectorManager();
         memoryManager = new SimpleMemoryManager();
         messageStore = new SimpleMessageStore();
         txRepository =
            new TransactionRepository(persistenceManager, messageStore, transactionIDManager);
View Full Code Here

        conn2 = (JBossConnection)cf.createConnection();
        Session sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
       
        ServerPeer peer = ServerManagement.getServer().getServerPeer();
       
        SimpleConnectionManager cm = (SimpleConnectionManager)peer.getConnectionManager();
       
        //Simulate failure on connection
       
        Map jmsClients = cm.getClients();
        assertEquals(1, jmsClients.size());
       
        Map endpoints = (Map)jmsClients.values().iterator().next();
       
        assertEquals(2, endpoints.size());
       
        Iterator iter = endpoints.entrySet().iterator();
             
        Map.Entry entry = (Map.Entry)iter.next();
       
        String sessId1 = (String)entry.getKey();
        
        entry = (Map.Entry)iter.next();
       
        //Simulate failure of connection
       
        cm.handleClientFailure(sessId1, true);
       
        //both connections should be shut
       
        jmsClients = cm.getClients();
        assertEquals(0, jmsClients.size());       
      }
      finally
      {
        if (conn1 != null)
View Full Code Here

   }
  

   public void testWithMock() throws Exception
   {
      SimpleConnectionManager cm = new SimpleConnectionManager();

      SimpleConnectionEndpoint e1 = new SimpleConnectionEndpoint(cm, "jvm1", "sessionid1");
      SimpleConnectionEndpoint e2 = new SimpleConnectionEndpoint(cm, "jvm1", "sessionid2");
      SimpleConnectionEndpoint e3 = new SimpleConnectionEndpoint(cm, "jvm2", "sessionid3");
      SimpleConnectionEndpoint e4 = new SimpleConnectionEndpoint(cm, "jvm2", "sessionid4");
      SimpleConnectionEndpoint e5 = new SimpleConnectionEndpoint(cm, "jvm3", "sessionid5");
      SimpleConnectionEndpoint e6 = new SimpleConnectionEndpoint(cm, "jvm3", "sessionid6");

      assertFalse(e1.isClosed());
      assertFalse(e2.isClosed());
      assertFalse(e3.isClosed());
      assertFalse(e4.isClosed());
      assertFalse(e5.isClosed());
      assertFalse(e6.isClosed());

      cm.registerConnection("jvm1", "sessionid1", e1);
      cm.registerConnection("jvm1", "sessionid2", e2);
      cm.registerConnection("jvm2", "sessionid3", e3);
      cm.registerConnection("jvm2", "sessionid4", e4);
      cm.registerConnection("jvm3", "sessionid5", e5);
      cm.registerConnection("jvm3", "sessionid6", e6);

      assertTrue(cm.containsRemotingSession("sessionid1"));
      assertTrue(cm.containsRemotingSession("sessionid2"));
      assertTrue(cm.containsRemotingSession("sessionid3"));
      assertTrue(cm.containsRemotingSession("sessionid4"));
      assertTrue(cm.containsRemotingSession("sessionid5"));
      assertTrue(cm.containsRemotingSession("sessionid6"));

      ConnectionEndpoint r1 = cm.unregisterConnection("jvm3", "sessionid6");
      assertEquals(e6, r1);
      assertFalse(e6.isClosed());

      assertNull(cm.unregisterConnection("blah", "blah"));

      assertFalse(cm.containsRemotingSession("sessionid6"));

      ConnectionEndpoint r2 = cm.unregisterConnection("jvm3", "sessionid5");
      assertEquals(e5, r2);
      assertFalse(e5.isClosed());

      assertFalse(cm.containsRemotingSession("sessionid5"));

      cm.handleClientFailure("sessionid4", true);

      assertNull(cm.unregisterConnection("jvm2", "sessionid4"));
      assertNull(cm.unregisterConnection("jvm2", "sessionid3"));

      assertFalse(cm.containsRemotingSession("sessionid4"));
      assertFalse(cm.containsRemotingSession("sessionid3"));

      assertTrue(e3.isClosed());
      assertTrue(e4.isClosed());

      ConnectionEndpoint r3 = cm.unregisterConnection("jvm1", "sessionid1");
      assertEquals(e1, r3);
      assertFalse(e1.isClosed());

      ConnectionEndpoint r4 = cm.unregisterConnection("jvm1", "sessionid2");
      assertEquals(e2, r4);
      assertFalse(e2.isClosed());

      assertFalse(cm.containsRemotingSession("sessionid2"));
      assertFalse(cm.containsRemotingSession("sessionid1"));

   }
View Full Code Here

TOP

Related Classes of org.jboss.jms.server.connectionmanager.SimpleConnectionManager$ConnectionFactoryCallbackInformation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.