You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by be...@apache.org on 2008/11/28 07:18:45 UTC

svn commit: r721354 - in /labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/im/handler: PresenceAvailInitialOutHandlerTestCase.java PresenceAvailUpdateOutHandlerTestCase.java PresenceHandlerTestCase.java

Author: berndf
Date: Thu Nov 27 22:18:45 2008
New Revision: 721354

URL: http://svn.apache.org/viewvc?rev=721354&view=rev
Log:
[vysper] split test in two cases

Added:
    labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceAvailInitialOutHandlerTestCase.java   (contents, props changed)
      - copied, changed from r721349, labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceHandlerTestCase.java
    labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceAvailUpdateOutHandlerTestCase.java
      - copied, changed from r721349, labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceHandlerTestCase.java
Removed:
    labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceHandlerTestCase.java

Copied: labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceAvailInitialOutHandlerTestCase.java (from r721349, labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceHandlerTestCase.java)
URL: http://svn.apache.org/viewvc/labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceAvailInitialOutHandlerTestCase.java?p2=labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceAvailInitialOutHandlerTestCase.java&p1=labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceHandlerTestCase.java&r1=721349&r2=721354&rev=721354&view=diff
==============================================================================
--- labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceHandlerTestCase.java (original)
+++ labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceAvailInitialOutHandlerTestCase.java Thu Nov 27 22:18:45 2008
@@ -19,17 +19,16 @@
 
 import org.apache.vysper.xmpp.addressing.EntityFormatException;
 import org.apache.vysper.xmpp.delivery.StanzaReceiverRelay;
-import org.apache.vysper.xmpp.stanza.PresenceStanzaType;
+import static org.apache.vysper.xmpp.stanza.PresenceStanzaType.PROBE;
 import org.apache.vysper.xmpp.stanza.Stanza;
 import org.apache.vysper.xmpp.stanza.StanzaBuilder;
 import org.apache.vysper.xmpp.stanza.XMPPCoreStanza;
-import static org.apache.vysper.xmpp.stanza.PresenceStanzaType.*;
 import org.apache.vysper.xmpp.state.resourcebinding.BindException;
 import org.apache.vysper.xmpp.state.resourcebinding.ResourceState;
 
 /**
  */
-public class PresenceHandlerTestCase extends PresenceHandlerBaseTestCase {
+public class PresenceAvailInitialOutHandlerTestCase extends PresenceHandlerBaseTestCase {
 
     protected PresenceHandler handler = new PresenceHandler();
 
@@ -84,63 +83,5 @@
         assertNull(subscribed_TO_Queue.getNext()); // pres NOT sent to TO contacts
     }
 
-    public void testUpdatedPresence() throws BindException, EntityFormatException {
-        StanzaReceiverRelay receiverRelay = (StanzaReceiverRelay) sessionContext.getServerRuntimeContext().getStanzaRelay();
 
-        // at first, initial presence
-        XMPPCoreStanza initialPresence = XMPPCoreStanza.getWrapper(StanzaBuilder.createPresenceStanza(null, null, null, null, null, null).getFinalStanza());
-        handler.executeCore(initialPresence, sessionContext.getServerRuntimeContext(), true, sessionContext);
-        assertTrue(0 < receiverRelay.getCountDelivered());
-        receiverRelay.resetAll(); // purge recorded 
-        assertTrue(0 == receiverRelay.getCountDelivered());
-        
-        // send update now
-        final String showValue = "chatty";
-        
-        XMPPCoreStanza updatePresence = XMPPCoreStanza.getWrapper(StanzaBuilder.createPresenceStanza(clientFullQualified, null, null, null, showValue, null).getFinalStanza());
-        handler.executeCore(updatePresence, sessionContext.getServerRuntimeContext(), true, sessionContext);
-        // check resource state 
-        assertEquals(ResourceState.AVAILABLE, getResourceState());
-
-        // 3 presence update broadcasts to same session + 2 presence to subscribers
-        assertEquals(3+2, ((StanzaReceiverRelay) sessionContext.getServerRuntimeContext().getStanzaRelay()).getCountDelivered());
-        
-        //
-        // check presence broadcasts to resources of same session (self, interested & available)
-        //
-        
-        Stanza initiatorNotification = initiatorsQueue.getNext();
-        assertNotNull(initiatorNotification);
-        assertTrue(checkPresence(initiatorNotification, null, clientFullQualified, showValue));
-        assertTrue(initiatorNotification.getVerifier().toAttributeEquals(clientFullQualified.getFullQualifiedName()));
-        
-        Stanza availableResourceNotification = anotherAvailableResourceQueue.getNext();
-        assertNotNull(availableResourceNotification);
-        assertTrue(checkPresence(availableResourceNotification, null, clientFullQualified, showValue));
-        assertTrue(availableResourceNotification.getVerifier().toAttributeEquals(client.getFullQualifiedName() + "/" + anotherAvailableResourceId));
-        assertNull(anotherAvailableResourceQueue.getNext()); // no more stanzas
-        
-        Stanza interestedResourceNotification = anotherInterestedResourceQueue.getNext();
-        assertNotNull(interestedResourceNotification);
-        assertTrue(checkPresence(interestedResourceNotification, null, clientFullQualified, showValue));
-        assertTrue(interestedResourceNotification.getVerifier().toAttributeEquals(client.getFullQualifiedName() + "/" + anotherInterestedResourceId));
-        assertNull(anotherInterestedResourceQueue.getNext()); // no more stanzas
-        
-        assertNull(anotherInterestedNotAvailResourceQueue.getNext()); // no stanza at all
-
-        //
-        // check other presences
-        //        
-        
-        assertNull(unrelatedQueue.getNext()); // does not sent pres to everybody arbitrarily
-        assertTrue(checkPresence(subscribed_FROM_Queue.getNext(), null, clientFullQualified, showValue)); // pres sent to FROM contacts
-        assertNull(subscribed_FROM_Queue.getNext()); // no second stanza sent to FROMs 
-
-        // initial pres and pres probe might come in different order
-        assertTrue(checkPresence(subscribed_BOTH_Queue.getNext(), null, clientFullQualified, showValue)); // pres sent to BOTH contacts
-        assertNull(subscribed_BOTH_Queue.getNext()); // no second stanza (especially probe) sent to BOTHs
-
-        assertNull(subscribed_TO_Queue.getNext()); // pres (especially probe)  NOT sent to TO contacts
-    }
-
-}
+}
\ No newline at end of file

Propchange: labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceAvailInitialOutHandlerTestCase.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Copied: labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceAvailUpdateOutHandlerTestCase.java (from r721349, labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceHandlerTestCase.java)
URL: http://svn.apache.org/viewvc/labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceAvailUpdateOutHandlerTestCase.java?p2=labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceAvailUpdateOutHandlerTestCase.java&p1=labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceHandlerTestCase.java&r1=721349&r2=721354&rev=721354&view=diff
==============================================================================
--- labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceHandlerTestCase.java (original)
+++ labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceAvailUpdateOutHandlerTestCase.java Thu Nov 27 22:18:45 2008
@@ -19,71 +19,18 @@
 
 import org.apache.vysper.xmpp.addressing.EntityFormatException;
 import org.apache.vysper.xmpp.delivery.StanzaReceiverRelay;
-import org.apache.vysper.xmpp.stanza.PresenceStanzaType;
 import org.apache.vysper.xmpp.stanza.Stanza;
 import org.apache.vysper.xmpp.stanza.StanzaBuilder;
 import org.apache.vysper.xmpp.stanza.XMPPCoreStanza;
-import static org.apache.vysper.xmpp.stanza.PresenceStanzaType.*;
 import org.apache.vysper.xmpp.state.resourcebinding.BindException;
 import org.apache.vysper.xmpp.state.resourcebinding.ResourceState;
 
 /**
  */
-public class PresenceHandlerTestCase extends PresenceHandlerBaseTestCase {
+public class PresenceAvailUpdateOutHandlerTestCase extends PresenceHandlerBaseTestCase {
 
     protected PresenceHandler handler = new PresenceHandler();
 
-    public void testInitialPresence() throws BindException, EntityFormatException {
-        XMPPCoreStanza initialPresence = XMPPCoreStanza.getWrapper(StanzaBuilder.createPresenceStanza(null, null, null, null, null, null).getFinalStanza());
-
-        assertEquals(ResourceState.CONNECTED, getResourceState());
-        handler.executeCore(initialPresence, sessionContext.getServerRuntimeContext(), true, sessionContext);
-        // check resource state change, do not override interested
-        assertEquals(ResourceState.AVAILABLE, getResourceState());
-
-        // 3 intial presence broadcasts to same session (but not to non-available) + 2 presence to subscribers + 2 probes to subscriptions
-        assertEquals(3+2+2, ((StanzaReceiverRelay) sessionContext.getServerRuntimeContext().getStanzaRelay()).getCountDelivered());
-        
-        //
-        // check presence broadcasts to resources of same session (self, interested & available)
-        //
-        
-        Stanza initiatorNotification = initiatorsQueue.getNext();
-        assertNotNull(initiatorNotification);
-        assertTrue(checkPresence(initiatorNotification, clientFullQualified, null));
-        assertTrue(initiatorNotification.getVerifier().toAttributeEquals(clientFullQualified.getFullQualifiedName()));
-        
-        Stanza availableResourceNotification = anotherAvailableResourceQueue.getNext();
-        assertNotNull(availableResourceNotification);
-        assertTrue(checkPresence(availableResourceNotification, clientFullQualified, null));
-        assertTrue(availableResourceNotification.getVerifier().toAttributeEquals(client.getFullQualifiedName() + "/" + anotherAvailableResourceId));
-        assertNull(anotherAvailableResourceQueue.getNext()); // no more stanzas
-        
-        Stanza interestedResourceNotification = anotherInterestedResourceQueue.getNext();
-        assertNotNull(interestedResourceNotification);
-        assertTrue(checkPresence(interestedResourceNotification, clientFullQualified, null));
-        assertTrue(interestedResourceNotification.getVerifier().toAttributeEquals(client.getFullQualifiedName() + "/" + anotherInterestedResourceId));
-        assertNull(anotherInterestedResourceQueue.getNext()); // no more stanzas
-
-        assertNull(anotherInterestedNotAvailResourceQueue.getNext()); // no stanza at all
-
-        //
-        // check other presences
-        //        
-        
-        assertNull(unrelatedQueue.getNext()); // does not sent pres to everybody arbitrarily
-        assertTrue(checkPresence(subscribed_FROM_Queue.getNext(), clientFullQualified, null)); // pres sent to FROM contacts
-        assertNull(subscribed_FROM_Queue.getNext()); // no second stanza sent to FROMs 
-
-        // initial pres and pres probe might come in different order
-        assertTrue(checkPresence(subscribed_BOTH_Queue.getNext(), clientFullQualified, null)); // pres sent to BOTH contacts
-        assertTrue(checkPresence(subscribed_BOTH_Queue.getNext(), clientFullQualified, PROBE)); // probe sent to BOTH contacts
-        assertNull(subscribed_BOTH_Queue.getNext()); // no third stanza sent to BOTHs 
-
-        assertTrue(checkPresence(subscribed_TO_Queue.getNext(), clientFullQualified, PROBE)); // probe sent to TO contacts
-        assertNull(subscribed_TO_Queue.getNext()); // pres NOT sent to TO contacts
-    }
-
     public void testUpdatedPresence() throws BindException, EntityFormatException {
         StanzaReceiverRelay receiverRelay = (StanzaReceiverRelay) sessionContext.getServerRuntimeContext().getStanzaRelay();
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org