Author: berndf
Date: Fri Apr 24 19:58:55 2009
New Revision: 768407

URL: http://svn.apache.org/viewvc?rev=768407&view=rev
Log:
[vysper] unit test improvements contributed by Michael Jackl (LABS-337)

Modified:
    
mina/sandbox/vysper/trunk/src/test/java/org/apache/vysper/xmpp/protocol/ProtocolWorkerProcessTestCase.java
    
mina/sandbox/vysper/trunk/src/test/java/org/apache/vysper/xmpp/server/TestSessionContext.java

Modified: 
mina/sandbox/vysper/trunk/src/test/java/org/apache/vysper/xmpp/protocol/ProtocolWorkerProcessTestCase.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/vysper/trunk/src/test/java/org/apache/vysper/xmpp/protocol/ProtocolWorkerProcessTestCase.java?rev=768407&r1=768406&r2=768407&view=diff
==============================================================================
--- 
mina/sandbox/vysper/trunk/src/test/java/org/apache/vysper/xmpp/protocol/ProtocolWorkerProcessTestCase.java
 (original)
+++ 
mina/sandbox/vysper/trunk/src/test/java/org/apache/vysper/xmpp/protocol/ProtocolWorkerProcessTestCase.java
 Fri Apr 24 19:58:55 2009
@@ -257,7 +257,7 @@
         protocolWorker.processStanza(sessionContext.getServerRuntimeContext(), 
sessionContext, stanzaBuilder.getFinalStanza(), sessionStateHolder);
         Stanza recordedResponse = sessionContext.getNextRecordedResponse();
         assertUnknownSenderError(recordedResponse); // not allowed, bare id 
without resource and two resources bound
-        sessionContext.write(null); // reset
+        sessionContext.reset();
         
         // unbind second resource, leaving only one
         boolean noResourceRemains = 
sessionContext.getServerRuntimeContext().getResourceRegistry().unbindResource(secondBoundResource);
@@ -269,7 +269,7 @@
         
stanzaBuilder.startInnerElement("query").addNamespaceAttribute("testNSURI").endInnerElement();
         protocolWorker.processStanza(sessionContext.getServerRuntimeContext(), 
sessionContext, stanzaBuilder.getFinalStanza(), sessionStateHolder);
         stanzaHandler.assertHandlerCalled();
-        sessionContext.write(null); // reset
+        sessionContext.reset();
 
         // second resource is now invalid and cannot be used anymore in a full 
qualified entity
         stanzaBuilder = StanzaBuilder.createIQStanza(null, null, 
IQStanzaType.GET, "test");

Modified: 
mina/sandbox/vysper/trunk/src/test/java/org/apache/vysper/xmpp/server/TestSessionContext.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/vysper/trunk/src/test/java/org/apache/vysper/xmpp/server/TestSessionContext.java?rev=768407&r1=768406&r2=768407&view=diff
==============================================================================
--- 
mina/sandbox/vysper/trunk/src/test/java/org/apache/vysper/xmpp/server/TestSessionContext.java
 (original)
+++ 
mina/sandbox/vysper/trunk/src/test/java/org/apache/vysper/xmpp/server/TestSessionContext.java
 Fri Apr 24 19:58:55 2009
@@ -97,18 +97,19 @@
     }
 
     /**
-     * @param stanza records the stanza. if NULL, the prev recorded stanza 
will be reset.
-     * @throws IllegalStateException if NOT NULL, and there is already a 
stanza recorded
+     * Resets all recorded stanzas and their count.
+     */
+    public void reset() {
+       recordedResponses.clear();
+        recordedResponsesTotal = 0;
+    }
+    
+    /**
+     * @param stanza records the stanza.
      */
     public void write(Stanza stanza) {
-        if (stanza == null) {
-            recordedResponses.clear();
-            recordedResponsesTotal = 0;
-            return;
-        } else {
-            recordedResponses.add(stanza);
-            recordedResponsesTotal++;
-        }
+        recordedResponses.add(stanza);
+        recordedResponsesTotal++;
     }
 
     public void setSessionState(SessionState sessionState) {


Reply via email to