labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ber...@apache.org
Subject svn commit: r710161 - in /labs/vysper/src: main/java/org/apache/vysper/xmpp/delivery/ main/java/org/apache/vysper/xmpp/modules/core/base/handler/ main/java/org/apache/vysper/xmpp/modules/core/sasl/handler/ main/java/org/apache/vysper/xmpp/modules/core/...
Date Mon, 03 Nov 2008 21:11:57 GMT
Author: berndf
Date: Mon Nov  3 13:11:56 2008
New Revision: 710161

URL: http://svn.apache.org/viewvc?rev=710161&view=rev
Log:
[vysper] LABS-225 prepare to handle stanzas only with server context, not session context

Modified:
    labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/DeliveringInboundStanzaRelay.java
    labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/StreamStartHandler.java
    labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/XMLPrologHandler.java
    labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/XMPPCoreStanzaHandler.java
    labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AbstractSASLHandler.java
    labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/starttls/handler/StartTLSHandler.java
    labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/ServiceUnavailableStanzaErrorHandler.java
    labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/StanzaHandler.java
    labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/StateAwareProtocolWorker.java
    labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/worker/AbstractStateAwareProtocolWorker.java
    labs/vysper/src/test/java/org/apache/vysper/smack/BasicClient.java
    labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/base/handler/IQHandlerTestCase.java
    labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/base/handler/MessageHandlerRelayTestCase.java
    labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AbortHandlerTestCase.java
    labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AuthHandlerPlainMechanismTestCase.java
    labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AuthHandlerUnavailableMechanismTestCase.java
    labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/starttls/handler/StartTLSHandlerTestCase.java
    labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/roster/handler/RosterIQHandlerTestCase.java
    labs/vysper/src/test/java/org/apache/vysper/xmpp/protocol/CallTestStanzaHandler.java
    labs/vysper/src/test/java/org/apache/vysper/xmpp/protocol/CallTestStanzaHandlerResponse.java

Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/DeliveringInboundStanzaRelay.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/DeliveringInboundStanzaRelay.java?rev=710161&r1=710160&r2=710161&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/DeliveringInboundStanzaRelay.java
(original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/DeliveringInboundStanzaRelay.java
Mon Nov  3 13:11:56 2008
@@ -112,23 +112,13 @@
         protected RelayResult deliver() {
             List<RelayResult> relayResults = new ArrayList<RelayResult>();
             try {
+                // TODO look into existing, offline accounts, too - not only online accounts

                 List<SessionContext> receivingSessions = resourceRegistry.getSessions(receiver);
                 if (receivingSessions == null || receivingSessions.size() == 0) {
                     logger.warn("cannot relay to {} stanza {}", receiver.getFullQualifiedName(),
stanza.toString());
                     return new RelayResult(new LocalRecipientNotReachableException());
-                }
-                for (SessionContext sessionContext : receivingSessions) {
-                    if (sessionContext.getState() != SessionState.AUTHENTICATED) {
-                        relayResults.add(new RelayResult(new DeliveryException("no relay
to non-authenticated sessions")));
-                        continue;
-                    }
-                    try {
-                        StanzaHandler stanzaHandler = sessionContext.getServerRuntimeContext().getHandler(stanza);
-                        INBOUND_STANZA_PROTOCOL_WORKER.processStanza(sessionContext, sessionStateHolder,
stanza, stanzaHandler);
-                    } catch (Exception e) {
-                        // TODO do not break out here. we should try to deliver to the others
first!
-                        relayResults.add(new RelayResult(new DeliveryException(e)));
-                    }
+                } else {
+                    relayToSessions(relayResults, receivingSessions);
                 }
             } catch (RuntimeException e) {
                 return new RelayResult(new DeliveryException(e));
@@ -140,6 +130,25 @@
             }
             return new RelayResult(); // return success result
         }
+
+        protected void relayToSessions(List<RelayResult> relayResults, List<SessionContext>
receivingSessions) {
+            if (receivingSessions.size() > 1) {
+                logger.warn("multiplexing: {} sessions will be processing {} ", receivingSessions.size(),
stanza);
+            }
+            for (SessionContext sessionContext : receivingSessions) {
+                if (sessionContext.getState() != SessionState.AUTHENTICATED) {
+                    relayResults.add(new RelayResult(new DeliveryException("no relay to non-authenticated
sessions")));
+                    continue;
+                }
+                try {
+                    StanzaHandler stanzaHandler = sessionContext.getServerRuntimeContext().getHandler(stanza);
+                    INBOUND_STANZA_PROTOCOL_WORKER.processStanza(sessionContext, sessionStateHolder,
stanza, stanzaHandler);
+                } catch (Exception e) {
+                    // TODO do not break out here. we should try to deliver to the others
first!
+                    relayResults.add(new RelayResult(new DeliveryException(e)));
+                }
+            }
+        }
     }
        
     private static class UnmodifyableSessionStateHolder extends SessionStateHolder {

Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/StreamStartHandler.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/StreamStartHandler.java?rev=710161&r1=710160&r2=710161&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/StreamStartHandler.java
(original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/StreamStartHandler.java
Mon Nov  3 13:11:56 2008
@@ -26,6 +26,7 @@
 import org.apache.vysper.xmpp.server.SessionContext;
 import org.apache.vysper.xmpp.server.SessionState;
 import org.apache.vysper.xmpp.server.XMPPVersion;
+import org.apache.vysper.xmpp.server.ServerRuntimeContext;
 import org.apache.vysper.xmpp.server.response.ServerResponses;
 import org.apache.vysper.xmpp.server.response.ServerErrorResponses;
 import org.apache.vysper.xmpp.stanza.Stanza;
@@ -49,7 +50,7 @@
         return namespaceURI.equals(NamespaceURIs.JABBER_CLIENT) || namespaceURI.equals(NamespaceURIs.JABBER_SERVER);
     }
 
-    public ResponseStanzaContainer execute(Stanza stanza, boolean isOutboundStanza, SessionContext
sessionContext, SessionStateHolder sessionStateHolder) {
+    public ResponseStanzaContainer execute(Stanza stanza, ServerRuntimeContext serverRuntimeContext,
boolean isOutboundStanza, SessionContext sessionContext, SessionStateHolder sessionStateHolder)
{
         XMLElementVerifier xmlElementVerifier = stanza.getVerifier();
         boolean jabberNamespace = xmlElementVerifier.namespacePresent(NamespaceURIs.HTTP_ETHERX_JABBER_ORG_STREAMS);
         boolean clientCall = xmlElementVerifier.namespacePresent(NamespaceURIs.JABBER_CLIENT);

Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/XMLPrologHandler.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/XMLPrologHandler.java?rev=710161&r1=710160&r2=710161&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/XMLPrologHandler.java
(original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/XMLPrologHandler.java
Mon Nov  3 13:11:56 2008
@@ -21,6 +21,7 @@
 import org.apache.vysper.xmpp.protocol.SessionStateHolder;
 import org.apache.vysper.xmpp.protocol.StanzaHandler;
 import org.apache.vysper.xmpp.server.SessionContext;
+import org.apache.vysper.xmpp.server.ServerRuntimeContext;
 import org.apache.vysper.xmpp.stanza.Stanza;
 import org.apache.vysper.xmpp.xmlfragment.XMLElementVerifier;
 
@@ -37,7 +38,7 @@
         return true;
     }
 
-    public ResponseStanzaContainer execute(Stanza stanza, boolean isOutboundStanza, SessionContext
sessionContext, SessionStateHolder sessionStateHolder) {
+    public ResponseStanzaContainer execute(Stanza stanza, ServerRuntimeContext serverRuntimeContext,
boolean isOutboundStanza, SessionContext sessionContext, SessionStateHolder sessionStateHolder)
{
         XMLElementVerifier xmlElementVerifier = stanza.getVerifier();
 
         String version = stanza.getAttribute("version").getValue();
@@ -47,4 +48,4 @@
         return null;
     }
 
-}
\ No newline at end of file
+}

Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/XMPPCoreStanzaHandler.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/XMPPCoreStanzaHandler.java?rev=710161&r1=710160&r2=710161&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/XMPPCoreStanzaHandler.java
(original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/XMPPCoreStanzaHandler.java
Mon Nov  3 13:11:56 2008
@@ -24,6 +24,7 @@
 import org.apache.vysper.xmpp.protocol.StanzaHandler;
 import org.apache.vysper.xmpp.protocol.StreamErrorCondition;
 import org.apache.vysper.xmpp.server.SessionContext;
+import org.apache.vysper.xmpp.server.ServerRuntimeContext;
 import org.apache.vysper.xmpp.server.response.ServerErrorResponses;
 import org.apache.vysper.xmpp.stanza.IQStanzaType;
 import org.apache.vysper.xmpp.stanza.Stanza;
@@ -48,7 +49,7 @@
     }
 
 
-    public ResponseStanzaContainer execute(Stanza anyStanza, boolean isOutboundStanza, SessionContext
sessionContext, SessionStateHolder sessionStateHolder) {
+    public ResponseStanzaContainer execute(Stanza anyStanza, ServerRuntimeContext serverRuntimeContext,
boolean isOutboundStanza, SessionContext sessionContext, SessionStateHolder sessionStateHolder)
{
         XMPPCoreStanza stanza = XMPPCoreStanza.getWrapper(anyStanza);
         if (stanza == null) throw new IllegalArgumentException("can only handle core XMPP
stanzas (iq, message, presence)");
 

Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AbstractSASLHandler.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AbstractSASLHandler.java?rev=710161&r1=710160&r2=710161&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AbstractSASLHandler.java
(original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AbstractSASLHandler.java
Mon Nov  3 13:11:56 2008
@@ -10,6 +10,7 @@
 import org.apache.vysper.xmpp.stanza.Stanza;
 import org.apache.vysper.xmpp.server.SessionContext;
 import org.apache.vysper.xmpp.server.SessionState;
+import org.apache.vysper.xmpp.server.ServerRuntimeContext;
 import org.apache.vysper.xmpp.server.response.ServerErrorResponses;
 import org.apache.vysper.xmpp.modules.core.sasl.AuthorizationRetriesCounter;
 import org.apache.vysper.xmpp.modules.core.sasl.SASLFailureType;
@@ -24,7 +25,7 @@
         return true;
     }
 
-    public ResponseStanzaContainer execute(Stanza stanza, boolean isOutboundStanza, SessionContext
sessionContext, SessionStateHolder sessionStateHolder) throws AuthorizationFailedException
{
+    public ResponseStanzaContainer execute(Stanza stanza, ServerRuntimeContext serverRuntimeContext,
boolean isOutboundStanza, SessionContext sessionContext, SessionStateHolder sessionStateHolder)
throws AuthorizationFailedException {
         if (!AuthorizationRetriesCounter.getFromSession(sessionContext).hasTriesLeft()) {
             AuthorizationFailedException failedException = new AuthorizationFailedException("too
many retries");
             failedException.setErrorStanza(ServerErrorResponses.getInstance().getStreamError(StreamErrorCondition.POLICY_VIOLATION,
null, null, null));

Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/starttls/handler/StartTLSHandler.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/starttls/handler/StartTLSHandler.java?rev=710161&r1=710160&r2=710161&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/starttls/handler/StartTLSHandler.java
(original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/starttls/handler/StartTLSHandler.java
Mon Nov  3 13:11:56 2008
@@ -24,6 +24,7 @@
 import org.apache.vysper.xmpp.protocol.StanzaHandler;
 import org.apache.vysper.xmpp.server.SessionContext;
 import org.apache.vysper.xmpp.server.SessionState;
+import org.apache.vysper.xmpp.server.ServerRuntimeContext;
 import org.apache.vysper.xmpp.server.response.ServerErrorResponses;
 import org.apache.vysper.xmpp.server.response.ServerResponses;
 import org.apache.vysper.xmpp.stanza.Stanza;
@@ -42,7 +43,7 @@
         return true;
     }
 
-    public ResponseStanzaContainer execute(Stanza stanza, boolean isOutboundStanza, SessionContext
sessionContext, SessionStateHolder sessionStateHolder) {
+    public ResponseStanzaContainer execute(Stanza stanza, ServerRuntimeContext serverRuntimeContext,
boolean isOutboundStanza, SessionContext sessionContext, SessionStateHolder sessionStateHolder)
{
         XMLElementVerifier xmlElementVerifier = stanza.getVerifier();
         boolean tlsNamespace = xmlElementVerifier.namespacePresent(NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_TLS);
 
@@ -66,4 +67,4 @@
     private ResponseStanzaContainer respondTLSFailure() {
         return new ResponseStanzaContainerImpl(ServerErrorResponses.getInstance().getTLSFailure());
     }
-}
\ No newline at end of file
+}

Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/ServiceUnavailableStanzaErrorHandler.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/ServiceUnavailableStanzaErrorHandler.java?rev=710161&r1=710160&r2=710161&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/ServiceUnavailableStanzaErrorHandler.java
(original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/ServiceUnavailableStanzaErrorHandler.java
Mon Nov  3 13:11:56 2008
@@ -17,6 +17,7 @@
 package org.apache.vysper.xmpp.protocol;
 
 import org.apache.vysper.xmpp.server.SessionContext;
+import org.apache.vysper.xmpp.server.ServerRuntimeContext;
 import org.apache.vysper.xmpp.server.response.ServerErrorResponses;
 import org.apache.vysper.xmpp.stanza.Stanza;
 import org.apache.vysper.xmpp.stanza.StanzaErrorCondition;
@@ -35,7 +36,7 @@
         return true;
     }
 
-    public ResponseStanzaContainer execute(Stanza stanza, boolean isOutboundStanza, SessionContext
sessionContext, SessionStateHolder sessionStateHolder) throws ProtocolException {
+    public ResponseStanzaContainer execute(Stanza stanza, ServerRuntimeContext serverRuntimeContext,
boolean isOutboundStanza, SessionContext sessionContext, SessionStateHolder sessionStateHolder)
throws ProtocolException {
         if (!(stanza instanceof XMPPCoreStanza)) {
             stanza = XMPPCoreStanza.getWrapper(stanza);
         }

Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/StanzaHandler.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/StanzaHandler.java?rev=710161&r1=710160&r2=710161&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/StanzaHandler.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/StanzaHandler.java Mon Nov 
3 13:11:56 2008
@@ -18,6 +18,7 @@
 package org.apache.vysper.xmpp.protocol;
 
 import org.apache.vysper.xmpp.server.SessionContext;
+import org.apache.vysper.xmpp.server.ServerRuntimeContext;
 import org.apache.vysper.xmpp.stanza.Stanza;
 
 /**
@@ -43,10 +44,12 @@
     /**
      * executes a stanza
      * @param stanza
-     * @param isOutboundStanza
+     * @param serverRuntimeContext
+     *@param isOutboundStanza
+     *   true, if the stanza was emitted by the client which is handled by the session belonging
to the give sessionContext parameter
+     *   false, if the session is receiving the stanza targeted to the session's client
      * @param sessionContext
-     * @param sessionStateHolder 
-     * @return optionally returns a response
+     * @param sessionStateHolder @return optionally returns a response which is passed to
the session's client
      */
-    public ResponseStanzaContainer execute(Stanza stanza, boolean isOutboundStanza, SessionContext
sessionContext, SessionStateHolder sessionStateHolder) throws ProtocolException;
+    public ResponseStanzaContainer execute(Stanza stanza, ServerRuntimeContext serverRuntimeContext,
boolean isOutboundStanza, SessionContext sessionContext, SessionStateHolder sessionStateHolder)
throws ProtocolException;
 }

Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/StateAwareProtocolWorker.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/StateAwareProtocolWorker.java?rev=710161&r1=710160&r2=710161&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/StateAwareProtocolWorker.java
(original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/StateAwareProtocolWorker.java
Mon Nov  3 13:11:56 2008
@@ -22,7 +22,8 @@
 
 /**
  * this handler is aware of the session state and can act accordingly.
- * the most interesting case is "authenticated", when the "common" XMPP happens (iq, message,
presence)
+ * for every session state, a dedicated implementation exists. 
+ * the most interesting case is "authenticated", where the "common" XMPP happens (iq, message,
presence)
  * special treatment has to be given to other states.
  */
 public interface StateAwareProtocolWorker {

Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/worker/AbstractStateAwareProtocolWorker.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/worker/AbstractStateAwareProtocolWorker.java?rev=710161&r1=710160&r2=710161&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/worker/AbstractStateAwareProtocolWorker.java
(original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/worker/AbstractStateAwareProtocolWorker.java
Mon Nov  3 13:11:56 2008
@@ -50,6 +50,9 @@
 
     protected void writeResponse(SessionContext sessionContext, ResponseStanzaContainer responseStanzaContainer)
{
         if (responseStanzaContainer != null && responseStanzaContainer.getResponseStanza()
!= null) {
+            if (sessionContext == null) {
+                throw new IllegalStateException("no session context to write stanza to: "
+ responseStanzaContainer.getResponseStanza());
+            }
             ResponseWriter.writeResponse(sessionContext, responseStanzaContainer);
         }
     }
@@ -57,7 +60,7 @@
     protected ResponseStanzaContainer executeHandler(SessionContext sessionContext, SessionStateHolder
sessionStateHolder, Stanza stanza, StanzaHandler stanzaHandler) {
         ResponseStanzaContainer responseStanzaContainer = null;
         try {
-            responseStanzaContainer = stanzaHandler.execute(stanza, isProcessingOutboundStanzas(),
sessionContext, sessionStateHolder);
+            responseStanzaContainer = stanzaHandler.execute(stanza, sessionContext.getServerRuntimeContext(),
isProcessingOutboundStanzas(), sessionContext, sessionStateHolder);
         } catch (ProtocolException e) {
             ResponseWriter.handleProtocolError(e, sessionContext, stanza);
             return null;

Modified: labs/vysper/src/test/java/org/apache/vysper/smack/BasicClient.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/test/java/org/apache/vysper/smack/BasicClient.java?rev=710161&r1=710160&r2=710161&view=diff
==============================================================================
--- labs/vysper/src/test/java/org/apache/vysper/smack/BasicClient.java (original)
+++ labs/vysper/src/test/java/org/apache/vysper/smack/BasicClient.java Mon Nov  3 13:11:56
2008
@@ -26,7 +26,6 @@
 import org.jivesoftware.smack.packet.Message;
 import org.jivesoftware.smack.packet.Presence;
 
-import java.util.Date;
 import java.util.Random;
 
 /**
@@ -78,7 +77,7 @@
             connection.sendPacket(new Presence(Presence.Type.available, "pommes", 1, Presence.Mode.available));
             
             while (to != null) {
-                chat.sendMessage("Hello " + to + " at " + new Date());
+//                chat.sendMessage("Hello " + to + " at " + new Date());
                 try { Thread.sleep((new Random().nextInt(9)+1)*1000 ); } catch (InterruptedException
e) { ; }
             }
 

Modified: labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/base/handler/IQHandlerTestCase.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/base/handler/IQHandlerTestCase.java?rev=710161&r1=710160&r2=710161&view=diff
==============================================================================
--- labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/base/handler/IQHandlerTestCase.java
(original)
+++ labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/base/handler/IQHandlerTestCase.java
Mon Nov  3 13:11:56 2008
@@ -53,7 +53,7 @@
         sessionContext.setServerToServer();
 
         TestIQHandler iqHandler = new TestIQHandler();
-        ResponseStanzaContainer responseStanzaContainer = iqHandler.execute(stanzaBuilder.getFinalStanza(),
true, sessionContext, null);
+        ResponseStanzaContainer responseStanzaContainer = iqHandler.execute(stanzaBuilder.getFinalStanza(),
sessionContext.getServerRuntimeContext(), true, sessionContext, null);
         Stanza responseStanza = responseStanzaContainer.getResponseStanza();
         XMLElementVerifier verifier = responseStanza.getVerifier();
         assertTrue("error", verifier.nameEquals("error"));
@@ -71,7 +71,7 @@
         Stanza stanza = stanzaBuilder.getFinalStanza(); // this stanza has no ID
 
         IQHandler iqHandler = new IQHandler();
-        ResponseStanzaContainer responseStanzaContainer = iqHandler.execute(stanza, true,
sessionContext, null);
+        ResponseStanzaContainer responseStanzaContainer = iqHandler.execute(stanza, sessionContext.getServerRuntimeContext(),
true, sessionContext, null);
         Stanza responseStanza = responseStanzaContainer.getResponseStanza();
         XMLElementVerifier verifier = responseStanza.getVerifier();
         assertTrue("error", verifier.nameEquals("error")); // response is _not_ IQ stanza
@@ -79,7 +79,7 @@
 
     private void assertIQError(Stanza stanza) {
         TestIQHandler iqHandler = new TestIQHandler();
-        ResponseStanzaContainer responseStanzaContainer = iqHandler.execute(stanza, true,
sessionContext, null);
+        ResponseStanzaContainer responseStanzaContainer = iqHandler.execute(stanza, sessionContext.getServerRuntimeContext(),
true, sessionContext, null);
         Stanza responseStanza = responseStanzaContainer.getResponseStanza();
         XMLElementVerifier verifier = responseStanza.getVerifier();
         assertTrue("iq", verifier.nameEquals("iq"));
@@ -142,7 +142,7 @@
         stanzaBuilder.startInnerElement("getRequest").endInnerElement();
 
         TestIQHandler iqHandler = new TestIQHandler();
-        ResponseStanzaContainer responseStanzaContainer = iqHandler.execute(stanzaBuilder.getFinalStanza(),
true, sessionContext, null);
+        ResponseStanzaContainer responseStanzaContainer = iqHandler.execute(stanzaBuilder.getFinalStanza(),
sessionContext.getServerRuntimeContext(), true, sessionContext, null);
         IQStanza incomingStanza = iqHandler.getIncomingStanza();
 
         XMPPCoreStanzaVerifier verifier = incomingStanza.getCoreVerifier();

Modified: labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/base/handler/MessageHandlerRelayTestCase.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/base/handler/MessageHandlerRelayTestCase.java?rev=710161&r1=710160&r2=710161&view=diff
==============================================================================
--- labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/base/handler/MessageHandlerRelayTestCase.java
(original)
+++ labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/base/handler/MessageHandlerRelayTestCase.java
Mon Nov  3 13:11:56 2008
@@ -61,7 +61,7 @@
         assertFalse(stanzaRelay.iterator().hasNext()); // nothing there yet
 
         Stanza stanza = stanzaBuilder.getFinalStanza();
-        ResponseStanzaContainer responseStanzaContainer = messageHandler.execute(stanza,
true, sessionContext, null);
+        ResponseStanzaContainer responseStanzaContainer = messageHandler.execute(stanza,
sessionContext.getServerRuntimeContext(), true, sessionContext, null);
 
         RecordingStanzaRelay.Triple triple = stanzaRelay.iterator().next();
         XMLElementVerifier timestampVerifier = triple.getStanza().getFirstInnerElement().getVerifier();
@@ -74,7 +74,7 @@
         stanzaRelay.reset();
         stanzaRelay.setAcceptingMode(false);
         
-        responseStanzaContainer = messageHandler.execute(stanza, true, sessionContext, null);
+        responseStanzaContainer = messageHandler.execute(stanza, sessionContext.getServerRuntimeContext(),
true, sessionContext, null);
         assertFalse(stanzaRelay.iterator().hasNext());
        
     }
@@ -91,11 +91,11 @@
         stanzaRelay.add(receiver, receiverQueue);
 
         Stanza successfulMessageStanza = StanzaBuilder.createMessageStanza(sender, receiver,
"en", "info").getFinalStanza();
-        ResponseStanzaContainer responseStanzaContainer = messageHandler.execute(successfulMessageStanza,
true, sessionContext, sessionStateHolder);
+        ResponseStanzaContainer responseStanzaContainer = messageHandler.execute(successfulMessageStanza,
sessionContext.getServerRuntimeContext(), true, sessionContext, sessionStateHolder);
         assertEquals(successfulMessageStanza, receiverQueue.getNext());
 
         Stanza failureMessageStanza = StanzaBuilder.createMessageStanza(sender, noReceiver,
"en", "info").getFinalStanza();
-        responseStanzaContainer = messageHandler.execute(failureMessageStanza, true, sessionContext,
sessionStateHolder);
+        responseStanzaContainer = messageHandler.execute(failureMessageStanza, sessionContext.getServerRuntimeContext(),
true, sessionContext, sessionStateHolder);
         assertNull(receiverQueue.getNext());
         Stanza rejectionStanza = senderQueue.getNext();
         assertNotNull(rejectionStanza);
@@ -104,4 +104,4 @@
 
     }
     
-}
\ No newline at end of file
+}

Modified: labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AbortHandlerTestCase.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AbortHandlerTestCase.java?rev=710161&r1=710160&r2=710161&view=diff
==============================================================================
--- labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AbortHandlerTestCase.java
(original)
+++ labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AbortHandlerTestCase.java
Mon Nov  3 13:11:56 2008
@@ -74,7 +74,7 @@
         // correct credential no longer work - no retries left
         AuthHandler authHandler = new AuthHandler();
         try {
-            ResponseStanzaContainer responseContainer = authHandler.execute(authPlainStanza,
true, sessionContext, sessionStateHolder);
+            ResponseStanzaContainer responseContainer = authHandler.execute(authPlainStanza,
sessionContext.getServerRuntimeContext(), true, sessionContext, sessionStateHolder);
             fail("should raise error - no tries left");
         } catch (AuthorizationFailedException e) {
             // test succeeded
@@ -105,7 +105,7 @@
         Stanza abortStanza = stanzaBuilder.getFinalStanza();
 
         AbortHandler abortHandler = new AbortHandler();
-        ResponseStanzaContainer responseContainer = abortHandler.execute(abortStanza, true,
sessionContext, sessionStateHolder);
+        ResponseStanzaContainer responseContainer = abortHandler.execute(abortStanza, sessionContext.getServerRuntimeContext(),
true, sessionContext, sessionStateHolder);
         Stanza responseStanza = responseContainer.getResponseStanza();
         return responseStanza;
     }
@@ -117,4 +117,4 @@
     }
 
 
-}
\ No newline at end of file
+}

Modified: labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AuthHandlerPlainMechanismTestCase.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AuthHandlerPlainMechanismTestCase.java?rev=710161&r1=710160&r2=710161&view=diff
==============================================================================
--- labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AuthHandlerPlainMechanismTestCase.java
(original)
+++ labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AuthHandlerPlainMechanismTestCase.java
Mon Nov  3 13:11:56 2008
@@ -64,7 +64,7 @@
         Stanza authPlainStanza = stanzaBuilder.getFinalStanza();
 
         AuthHandler authHandler = new AuthHandler();
-        ResponseStanzaContainer responseContainer = authHandler.execute(authPlainStanza,
true, sessionContext, sessionStateHolder);
+        ResponseStanzaContainer responseContainer = authHandler.execute(authPlainStanza,
sessionContext.getServerRuntimeContext(), true, sessionContext, sessionStateHolder);
 
         assertTrue(responseContainer.getResponseStanza().getVerifier().nameEquals("failure"));
         assertTrue(sessionStateHolder.getState() == SessionState.ENCRYPTED);
@@ -76,7 +76,7 @@
         Stanza authPlainStanza = stanzaBuilder.getFinalStanza();
 
         AuthHandler authHandler = new AuthHandler();
-        ResponseStanzaContainer responseContainer = authHandler.execute(authPlainStanza,
true, sessionContext, sessionStateHolder);
+        ResponseStanzaContainer responseContainer = authHandler.execute(authPlainStanza,
sessionContext.getServerRuntimeContext(), true, sessionContext, sessionStateHolder);
 
         assertTrue(responseContainer.getResponseStanza().getVerifier().nameEquals("failure"));
         assertTrue(sessionStateHolder.getState() == SessionState.ENCRYPTED);
@@ -91,7 +91,7 @@
         assertEquals(3, AuthorizationRetriesCounter.getFromSession(sessionContext).getTriesLeft());
 
         AuthHandler authHandler = new AuthHandler();
-        ResponseStanzaContainer responseContainer = authHandler.execute(authPlainStanza,
true, sessionContext, sessionStateHolder);
+        ResponseStanzaContainer responseContainer = authHandler.execute(authPlainStanza,
sessionContext.getServerRuntimeContext(), true, sessionContext, sessionStateHolder);
         Stanza responseStanza = responseContainer.getResponseStanza();
         
         assertTrue(responseStanza.getVerifier().nameEquals("success"));
@@ -110,7 +110,7 @@
         // correct credential no longer work - no retries left
         AuthHandler authHandler = new AuthHandler();
         try {
-            ResponseStanzaContainer responseContainer = authHandler.execute(authPlainStanza,
true, sessionContext, sessionStateHolder);
+            ResponseStanzaContainer responseContainer = authHandler.execute(authPlainStanza,
sessionContext.getServerRuntimeContext(), true, sessionContext, sessionStateHolder);
             fail("should raise error - no tries left");
         } catch (AuthorizationFailedException e) {
             // test succeeded
@@ -142,7 +142,7 @@
         Stanza authPlainStanza = stanzaBuilder.getFinalStanza();
 
         AuthHandler authHandler = new AuthHandler();
-        ResponseStanzaContainer responseContainer = authHandler.execute(authPlainStanza,
true, sessionContext, sessionStateHolder);
+        ResponseStanzaContainer responseContainer = authHandler.execute(authPlainStanza,
sessionContext.getServerRuntimeContext(), true, sessionContext, sessionStateHolder);
         Stanza responseStanza = responseContainer.getResponseStanza();
         return responseStanza;
     }
@@ -154,4 +154,4 @@
         return stanzaBuilder;
     }
 
-}
\ No newline at end of file
+}

Modified: labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AuthHandlerUnavailableMechanismTestCase.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AuthHandlerUnavailableMechanismTestCase.java?rev=710161&r1=710160&r2=710161&view=diff
==============================================================================
--- labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AuthHandlerUnavailableMechanismTestCase.java
(original)
+++ labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AuthHandlerUnavailableMechanismTestCase.java
Mon Nov  3 13:11:56 2008
@@ -59,7 +59,7 @@
 
         AuthHandler authHandler = new AuthHandler();
         try {
-            ResponseStanzaContainer responseContainer = authHandler.execute(authPlainStanza,
true, sessionContext, sessionStateHolder);
+            ResponseStanzaContainer responseContainer = authHandler.execute(authPlainStanza,
sessionContext.getServerRuntimeContext(), true, sessionContext, sessionStateHolder);
 
             fail("should raise exception");
         } catch (RuntimeException e) {
@@ -75,7 +75,7 @@
 
         AuthHandler authHandler = new AuthHandler();
         try {
-            ResponseStanzaContainer responseContainer = authHandler.execute(authPlainStanza,
true, sessionContext, sessionStateHolder);
+            ResponseStanzaContainer responseContainer = authHandler.execute(authPlainStanza,
sessionContext.getServerRuntimeContext(), true, sessionContext, sessionStateHolder);
 
             fail("should raise exception");
         } catch (RuntimeException e) {
@@ -83,4 +83,4 @@
         }
     }
 
-}
\ No newline at end of file
+}

Modified: labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/starttls/handler/StartTLSHandlerTestCase.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/starttls/handler/StartTLSHandlerTestCase.java?rev=710161&r1=710160&r2=710161&view=diff
==============================================================================
--- labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/starttls/handler/StartTLSHandlerTestCase.java
(original)
+++ labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/core/starttls/handler/StartTLSHandlerTestCase.java
Mon Nov  3 13:11:56 2008
@@ -70,7 +70,7 @@
 
     private Stanza executeStartTLSHandler(Stanza starttlsStanza, TestSessionContext sessionContext)
{
         StartTLSHandler startTLSHandler = new StartTLSHandler();
-        ResponseStanzaContainer responseStanzaContainer = startTLSHandler.execute(starttlsStanza,
true, sessionContext, sessionStateHolder);
+        ResponseStanzaContainer responseStanzaContainer = startTLSHandler.execute(starttlsStanza,
sessionContext.getServerRuntimeContext(), true, sessionContext, sessionStateHolder);
         Stanza responseStanza = responseStanzaContainer.getResponseStanza();
         return responseStanza;
     }
@@ -99,4 +99,4 @@
         assertTrue("tls init", sessionContext.isSwitchToTLSCalled());
     }
     
-}
\ No newline at end of file
+}

Modified: labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/roster/handler/RosterIQHandlerTestCase.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/roster/handler/RosterIQHandlerTestCase.java?rev=710161&r1=710160&r2=710161&view=diff
==============================================================================
--- labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/roster/handler/RosterIQHandlerTestCase.java
(original)
+++ labs/vysper/src/test/java/org/apache/vysper/xmpp/modules/roster/handler/RosterIQHandlerTestCase.java
Mon Nov  3 13:11:56 2008
@@ -38,7 +38,7 @@
         StanzaBuilder stanzaBuilder = createRosterGet();
 
         assertEquals(ResourceState.CONNECTED, getResourceState());
-        handler.execute(stanzaBuilder.getFinalStanza(), true, sessionContext, null);
+        handler.execute(stanzaBuilder.getFinalStanza(), sessionContext.getServerRuntimeContext(),
true, sessionContext, null);
         assertEquals(ResourceState.INTERESTED_NOT_YET_AVAILABLE, getResourceState());
         
 //        C: <iq from='juliet@example.com/balcony'
@@ -56,7 +56,7 @@
         // mock intial presence resource state change
         sessionContext.getServerRuntimeContext().getResourceRegistry().setResourceState(boundResourceId,
ResourceState.AVAILABLE);
         
-        handler.execute(stanzaBuilder.getFinalStanza(), true, sessionContext, null);
+        handler.execute(stanzaBuilder.getFinalStanza(), sessionContext.getServerRuntimeContext(),
true, sessionContext, null);
         assertEquals(ResourceState.INTERESTED, getResourceState());
     }
 

Modified: labs/vysper/src/test/java/org/apache/vysper/xmpp/protocol/CallTestStanzaHandler.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/test/java/org/apache/vysper/xmpp/protocol/CallTestStanzaHandler.java?rev=710161&r1=710160&r2=710161&view=diff
==============================================================================
--- labs/vysper/src/test/java/org/apache/vysper/xmpp/protocol/CallTestStanzaHandler.java (original)
+++ labs/vysper/src/test/java/org/apache/vysper/xmpp/protocol/CallTestStanzaHandler.java Mon
Nov  3 13:11:56 2008
@@ -18,6 +18,7 @@
 package org.apache.vysper.xmpp.protocol;
 
 import org.apache.vysper.xmpp.server.SessionContext;
+import org.apache.vysper.xmpp.server.ServerRuntimeContext;
 import org.apache.vysper.xmpp.stanza.Stanza;
 import org.apache.vysper.xmpp.xmlfragment.XMLElement;
 
@@ -69,7 +70,7 @@
         this.exception = exception;
     }
 
-    public ResponseStanzaContainer execute(Stanza stanza, boolean isOutboundStanza, SessionContext
sessionContext, SessionStateHolder sessionStateHolder) throws ProtocolException {
+    public ResponseStanzaContainer execute(Stanza stanza, ServerRuntimeContext serverRuntimeContext,
boolean isOutboundStanza, SessionContext sessionContext, SessionStateHolder sessionStateHolder)
throws ProtocolException {
         if (stanza == null || !stanza.getName().equals(getName()) || sessionContext == null)
throw new RuntimeException("test failed");
         handlerCalled = true;
         if (exception != null) throw exception;

Modified: labs/vysper/src/test/java/org/apache/vysper/xmpp/protocol/CallTestStanzaHandlerResponse.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/test/java/org/apache/vysper/xmpp/protocol/CallTestStanzaHandlerResponse.java?rev=710161&r1=710160&r2=710161&view=diff
==============================================================================
--- labs/vysper/src/test/java/org/apache/vysper/xmpp/protocol/CallTestStanzaHandlerResponse.java
(original)
+++ labs/vysper/src/test/java/org/apache/vysper/xmpp/protocol/CallTestStanzaHandlerResponse.java
Mon Nov  3 13:11:56 2008
@@ -19,6 +19,7 @@
 
 import org.apache.vysper.xmpp.stanza.Stanza;
 import org.apache.vysper.xmpp.server.SessionContext;
+import org.apache.vysper.xmpp.server.ServerRuntimeContext;
 
 /**
  */
@@ -30,8 +31,8 @@
     }
 
     @Override
-    public ResponseStanzaContainer execute(Stanza stanza, boolean isOutboundStanza, SessionContext
sessionContext, SessionStateHolder sessionStateHolder) throws ProtocolException {
-        super.execute(stanza, true, sessionContext, null);
+    public ResponseStanzaContainer execute(Stanza stanza, ServerRuntimeContext serverRuntimeContext,
boolean isOutboundStanza, SessionContext sessionContext, SessionStateHolder sessionStateHolder)
throws ProtocolException {
+        super.execute(stanza, serverRuntimeContext, true, sessionContext, null);
         return new ResponseStanzaContainerImpl(getResponseStanza());
     }
 



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


Mime
View raw message