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 2009/03/19 06:59:39 UTC
svn commit: r755842 - in /labs/vysper: ./ src/main/config/
src/main/java/org/apache/vysper/compliance/
src/main/java/org/apache/vysper/compliance/reporting/
src/main/java/org/apache/vysper/xmpp/addressing/stringprep/
src/main/java/org/apache/vysper/xmp...
Author: berndf
Date: Thu Mar 19 05:59:38 2009
New Revision: 755842
URL: http://svn.apache.org/viewvc?rev=755842&view=rev
Log:
[vysper] LABS-316 improve the spec compliant doc generation + edit the SpecCompliant annotations on the target classes --
factor out AccountVerification interface from UserAuthorization and use it for relaying --
handle 'user offline' and 'user not existing' as two different cases --
remove unused code
Added:
labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/AccountVerification.java
labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/LocalRecipientOfflineException.java
- copied, changed from r755481, labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/LocalRecipientNotReachableException.java
labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/NoSuchLocalUserException.java
Removed:
labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/LocalRecipientNotReachableException.java
labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/jabber/handler/JabberClientStanzaDictionary.java
labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/jabber/handler/JabberServerStanzaDictionary.java
Modified:
labs/vysper/build.xml
labs/vysper/src/main/config/spring-config.xml
labs/vysper/src/main/java/org/apache/vysper/compliance/SpecCompliant.java
labs/vysper/src/main/java/org/apache/vysper/compliance/reporting/DocumentSpecCompliantAnnotationFactory.java
labs/vysper/src/main/java/org/apache/vysper/xmpp/addressing/stringprep/NodePrep.java
labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/Anonymous.java
labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/External.java
labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/Plain.java
labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/SimpleUserAuthorization.java
labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/UserAuthorization.java
labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/DeliveringInboundStanzaRelay.java
labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/StanzaReceiverRelay.java
labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/failure/ReturnErrorToSenderFailureStrategy.java
labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/IQHandler.java
labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/compatibility/jabber_iq_auth/handler/AuthCompatibilityIQHandler.java
labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceSubscriptionHandler.java
labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0092_software_version/SoftwareVersionIQHandler.java
labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/RosterUtils.java
labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/handler/RosterIQHandler.java
labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/servicediscovery/handler/DiscoInfoIQHandler.java
labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/servicediscovery/handler/DiscoItemIQHandler.java
labs/vysper/src/main/java/org/apache/vysper/xmpp/server/DefaultServerRuntimeContext.java
labs/vysper/src/main/java/org/apache/vysper/xmpp/server/ServerMain.java
labs/vysper/src/main/java/org/apache/vysper/xmpp/server/XMPPServer.java
labs/vysper/src/test/java/org/apache/vysper/smack/BasicClient.java
labs/vysper/src/test/java/org/apache/vysper/xmpp/delivery/DeliveringStanzaRelayTestCase.java
Modified: labs/vysper/build.xml
URL: http://svn.apache.org/viewvc/labs/vysper/build.xml?rev=755842&r1=755841&r2=755842&view=diff
==============================================================================
--- labs/vysper/build.xml (original)
+++ labs/vysper/build.xml Thu Mar 19 05:59:38 2009
@@ -116,9 +116,9 @@
<target name="clean" depends="clean.vysper" description="cleanup all"/>
- <target name="all" depends="init, clean, compile.vysper, docs, run-unit-tests, package" description="build all"/>
+ <target name="all" depends="init, clean, compile.vysper, generate-javadoc, run-unit-tests, package" description="build all"/>
- <target name="docs" description="generate javadocs">
+ <target name="generate-javadoc" description="generate javadocs">
<mkdir dir="${basedir}/build/ant/apidocs" />
<javadoc sourcepathref="sourcepath" destdir="${vysper.docs.dir}">
</javadoc>
Modified: labs/vysper/src/main/config/spring-config.xml
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/config/spring-config.xml?rev=755842&r1=755841&r2=755842&view=diff
==============================================================================
--- labs/vysper/src/main/config/spring-config.xml (original)
+++ labs/vysper/src/main/config/spring-config.xml Thu Mar 19 05:59:38 2009
@@ -36,6 +36,7 @@
<bean id="internalOutboundRelay" class="org.apache.vysper.xmpp.delivery.DeliveringInboundStanzaRelay" >
<constructor-arg ref="resourceRegistry"/>
+ <constructor-arg ref="userAuthentication"/>
</bean>
<bean id="stanzaRelay" class="org.apache.vysper.xmpp.delivery.StanzaRelayBroker" >
@@ -46,6 +47,16 @@
<bean name="resourceRegistry" class="org.apache.vysper.xmpp.state.resourcebinding.ResourceRegistry" />
+ <bean id="userAuthentication" class="org.apache.vysper.xmpp.authorization.SimpleUserAuthorization">
+ <constructor-arg index="0">
+ <map>
+ <entry key="user1@vysper.org" value="password1" />
+ <entry key="user2@vysper.org" value="password1" />
+ <entry key="user3@vysper.org" value="password1" />
+ </map>
+ </constructor-arg>
+ </bean>
+
<bean id="serverFeatures" class="org.apache.vysper.xmpp.server.ServerFeatures">
<property name="authenticationMethods">
<list>
@@ -78,17 +89,7 @@
</constructor-arg>
<constructor-arg ref="resourceRegistry"/>
<property name="tlsContextFactory" ref="tlsContextFactory" />
- <property name="userAuthorization" >
- <bean class="org.apache.vysper.xmpp.authorization.SimpleUserAuthorization">
- <constructor-arg index="0">
- <map>
- <entry key="user1@vysper.org" value="password1" />
- <entry key="user2@vysper.org" value="password1" />
- <entry key="user3@vysper.org" value="password1" />
- </map>
- </constructor-arg>
- </bean>
- </property>
+ <property name="userAuthorization" ref="userAuthentication" />
<property name="modules">
<list>
<bean class="org.apache.vysper.xmpp.modules.servicediscovery.ServiceDiscoveryModule" />
Modified: labs/vysper/src/main/java/org/apache/vysper/compliance/SpecCompliant.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/compliance/SpecCompliant.java?rev=755842&r1=755841&r2=755842&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/compliance/SpecCompliant.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/compliance/SpecCompliant.java Thu Mar 19 05:59:38 2009
@@ -17,11 +17,14 @@
@Retention(RetentionPolicy.SOURCE)
public @interface SpecCompliant {
public enum ComplianceStatus {
- NOT_STARTED, PARTIAL, FINISHED
+ NOT_STARTED, IN_PROGRESS, FINISHED
}
-
+
public enum ComplianceCoverage {
- UNKNOWN, PARTIAL, COMPLETE
+ UNKNOWN,
+ UNSUPPORTED, // the spec is not supported
+ PARTIAL, // spec is partially covered
+ COMPLETE // spec is completely covered
}
/**
@@ -44,7 +47,7 @@
*
* @return the compliance status
*/
- ComplianceStatus status() default ComplianceStatus.PARTIAL;
+ ComplianceStatus status() default ComplianceStatus.IN_PROGRESS;
/**
* Specifies the level of coverage for the referenced spec/section. If known, the referenced spec extract
Modified: labs/vysper/src/main/java/org/apache/vysper/compliance/reporting/DocumentSpecCompliantAnnotationFactory.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/compliance/reporting/DocumentSpecCompliantAnnotationFactory.java?rev=755842&r1=755841&r2=755842&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/compliance/reporting/DocumentSpecCompliantAnnotationFactory.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/compliance/reporting/DocumentSpecCompliantAnnotationFactory.java Thu Mar 19 05:59:38 2009
@@ -1,3 +1,19 @@
+/***********************************************************************
+ * Copyright (c) 2006-2008 The Apache Software Foundation. *
+ * All rights reserved. *
+ * ------------------------------------------------------------------- *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you *
+ * may not use this file except in compliance with the License. You *
+ * may obtain a copy of the License at: *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, software *
+ * distributed under the License is distributed on an "AS IS" BASIS, *
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or *
+ * implied. See the License for the specific language governing *
+ * permissions and limitations under the License. *
+ ***********************************************************************/
package org.apache.vysper.compliance.reporting;
import com.sun.mirror.apt.AnnotationProcessor;
@@ -114,10 +130,14 @@
// spec section
fileWriter.print("<td>");
- final String specSection = doc.getSpecSection();
- if (specURL != null) fileWriter.print("<a href='" + specURL + "#section-" + specSection + "'>");
- if (specSection != null) fileWriter.print(specSection);
- if (specURL != null) fileWriter.print("</a>");
+ String specSection = doc.getSpecSection();
+ if (specSection != null && specSection.length() > 0) {
+ if (specSection.endsWith(".")) specSection = specSection.substring(0, specSection.length() - 1);
+ String anchorLink = Character.isDigit(specSection.charAt(0)) ? "#section-" : "#appendix-";
+ if (specURL != null) fileWriter.print("<a href='" + specURL + anchorLink + specSection + "'>");
+ fileWriter.print(specSection);
+ if (specURL != null) fileWriter.print("</a>");
+ }
fileWriter.print("</td>");
@@ -133,7 +153,7 @@
fileWriter.print("<td>");
final String className = doc.getClassName();
if (className != null) {
- fileWriter.print("<a href='" + className.replace(".", "/") + ".html'>");
+ fileWriter.print("<a href='" + doc.getFQClassName().replace(".", "/") + ".html'>");
fileWriter.print(o_a_v_cut(packageName, className));
fileWriter.print("</a>");
}
@@ -212,6 +232,18 @@
}
}
+ public String getFQClassName() {
+ if (declaration instanceof FieldDeclaration || declaration instanceof MethodDeclaration) {
+ MemberDeclaration memberDeclaration = (MemberDeclaration) declaration;
+ return memberDeclaration.getDeclaringType().getQualifiedName();
+ } else if(declaration instanceof ClassDeclaration) {
+ ClassDeclaration classDeclaration = (ClassDeclaration) declaration;
+ return classDeclaration.getPackage() + "." + classDeclaration.getSimpleName();
+ } else {
+ return declaration.getSimpleName();
+ }
+ }
+
public String getPackage() {
if (declaration instanceof TypeDeclaration ) {
TypeDeclaration typeDeclaration = (TypeDeclaration) declaration;
Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/addressing/stringprep/NodePrep.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/addressing/stringprep/NodePrep.java?rev=755842&r1=755841&r2=755842&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/addressing/stringprep/NodePrep.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/addressing/stringprep/NodePrep.java Thu Mar 19 05:59:38 2009
@@ -1,12 +1,12 @@
package org.apache.vysper.xmpp.addressing.stringprep;
+import org.apache.vysper.compliance.SpecCompliant;
+import org.apache.vysper.compliance.SpecCompliant.ComplianceStatus;
+
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
-import org.apache.vysper.compliance.SpecCompliant;
-import org.apache.vysper.compliance.SpecCompliant.ComplianceStatus;
-
/**
* This class is used to prepare a Node Identifier for further usage.
*
@@ -16,7 +16,7 @@
* @author Gerolf Seitz (gseitz@apache.org)
*
*/
-@SpecCompliant(spec = "RFC3920", section = "A", status = ComplianceStatus.PARTIAL)
+@SpecCompliant(spec = "RFC3920", section = "A", status = ComplianceStatus.IN_PROGRESS)
public class NodePrep extends StringPrep {
private static final NodePrep INSTANCE = new NodePrep();
Added: labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/AccountVerification.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/AccountVerification.java?rev=755842&view=auto
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/AccountVerification.java (added)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/AccountVerification.java Thu Mar 19 05:59:38 2009
@@ -0,0 +1,28 @@
+/***********************************************************************
+ * Copyright (c) 2006-2008 The Apache Software Foundation. *
+ * All rights reserved. *
+ * ------------------------------------------------------------------- *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you *
+ * may not use this file except in compliance with the License. You *
+ * may obtain a copy of the License at: *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, software *
+ * distributed under the License is distributed on an "AS IS" BASIS, *
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or *
+ * implied. See the License for the specific language governing *
+ * permissions and limitations under the License. *
+ ***********************************************************************/
+package org.apache.vysper.xmpp.authorization;
+
+import org.apache.vysper.xmpp.addressing.Entity;
+
+/**
+ */
+public interface AccountVerification {
+ /**
+ * checks if there is this jid is registered with the server
+ */
+ boolean verifyAccountExists(Entity jid);
+}
Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/Anonymous.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/Anonymous.java?rev=755842&r1=755841&r2=755842&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/Anonymous.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/Anonymous.java Thu Mar 19 05:59:38 2009
@@ -23,10 +23,15 @@
import org.apache.vysper.xmpp.stanza.Stanza;
import org.apache.vysper.xmpp.uuid.JVMBuiltinUUIDGenerator;
import org.apache.vysper.xmpp.uuid.UUIDGenerator;
+import org.apache.vysper.compliance.SpecCompliance;
+import org.apache.vysper.compliance.SpecCompliant;
+import static org.apache.vysper.compliance.SpecCompliant.ComplianceStatus.*;
+import static org.apache.vysper.compliance.SpecCompliant.ComplianceCoverage.*;
/**
* handles SASL ANONYMOUS mechanism, where no credentials are required
*/
+@SpecCompliant(spec="rfc4505", status= FINISHED, coverage = COMPLETE)
public class Anonymous implements SASLMechanism {
UUIDGenerator uuidGenerator = new JVMBuiltinUUIDGenerator();
Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/External.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/External.java?rev=755842&r1=755841&r2=755842&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/External.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/External.java Thu Mar 19 05:59:38 2009
@@ -19,10 +19,18 @@
import org.apache.vysper.xmpp.server.SessionContext;
import org.apache.vysper.xmpp.protocol.SessionStateHolder;
import org.apache.vysper.xmpp.stanza.Stanza;
+import org.apache.vysper.compliance.SpecCompliance;
+import org.apache.vysper.compliance.SpecCompliant;
+import static org.apache.vysper.compliance.SpecCompliant.ComplianceStatus.*;
+import static org.apache.vysper.compliance.SpecCompliant.ComplianceCoverage.*;
/**
* handles SASL EXTERNAL mechanism
*/
+@SpecCompliance( compliant = {
+ @SpecCompliant(spec="rfc4422", section = "A.", status = NOT_STARTED, coverage = PARTIAL, comment = "only Appendix A. is relevant here"),
+ @SpecCompliant(spec="rfc3920bis-09", section = "15.6.", status = IN_PROGRESS, coverage = PARTIAL, comment = "EXTERNAL is mandatory")
+})
public class External implements SASLMechanism {
public String getName() {
return "EXTERNAL";
@@ -31,4 +39,4 @@
public Stanza started(SessionContext sessionContext, SessionStateHolder sessionStateHolder, Stanza authStanza) {
throw new RuntimeException("not yet implemented");
}
-}
\ No newline at end of file
+}
Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/Plain.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/Plain.java?rev=755842&r1=755841&r2=755842&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/Plain.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/Plain.java Thu Mar 19 05:59:38 2009
@@ -25,6 +25,10 @@
import org.apache.vysper.xmpp.server.SessionState;
import org.apache.vysper.xmpp.stanza.Stanza;
import org.apache.vysper.xmpp.xmlfragment.XMLText;
+import org.apache.vysper.compliance.SpecCompliant;
+import org.apache.vysper.compliance.SpecCompliance;
+import static org.apache.vysper.compliance.SpecCompliant.ComplianceStatus.*;
+import static org.apache.vysper.compliance.SpecCompliant.ComplianceCoverage.*;
import java.util.ArrayList;
import java.util.List;
@@ -32,6 +36,10 @@
/**
* handles SASL PLAIN mechanism. this mechanism is standardized in RFC4616
*/
+@SpecCompliance( compliant = {
+ @SpecCompliant(spec="rfc4616", status= IN_PROGRESS, coverage = PARTIAL),
+ @SpecCompliant(spec="rfc3920bis-09", section = "15.6.", status= IN_PROGRESS, coverage = PARTIAL, comment = "PLAIN is mandatory now")
+})
public class Plain implements SASLMechanism {
private static final AuthorizationResponses AUTHORIZATION_RESPONSES = new AuthorizationResponses();
Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/SimpleUserAuthorization.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/SimpleUserAuthorization.java?rev=755842&r1=755841&r2=755842&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/SimpleUserAuthorization.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/SimpleUserAuthorization.java Thu Mar 19 05:59:38 2009
@@ -24,7 +24,7 @@
/**
* very simple in-memory {@link org.apache.vysper.xmpp.authorization.UserAuthorization} service
*/
-public class SimpleUserAuthorization implements UserAuthorization {
+public class SimpleUserAuthorization implements UserAuthorization, AccountVerification {
private final Map<String, String> userPasswordMap = new HashMap<String, String>();
@@ -48,7 +48,7 @@
return verify(username, passwordCleartext);
}
- public boolean verifyUserExists(Entity jid) {
+ public boolean verifyAccountExists(Entity jid) {
return userPasswordMap.get(jid.getBareJID().getFullQualifiedName()) != null;
}
Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/UserAuthorization.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/UserAuthorization.java?rev=755842&r1=755841&r2=755842&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/UserAuthorization.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/UserAuthorization.java Thu Mar 19 05:59:38 2009
@@ -34,8 +34,4 @@
*/
boolean verifyCredentials(String username, String passwordCleartext, Object credentials);
- /**
- * checks if there is a user registration for the supplied JID
- */
- boolean verifyUserExists(Entity jid);
}
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=755842&r1=755841&r2=755842&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 Thu Mar 19 05:59:38 2009
@@ -24,6 +24,7 @@
import org.apache.vysper.xmpp.server.SessionContext;
import org.apache.vysper.xmpp.server.SessionState;
import org.apache.vysper.xmpp.stanza.Stanza;
+import org.apache.vysper.xmpp.authorization.AccountVerification;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -48,9 +49,11 @@
protected ResourceRegistry resourceRegistry;
protected ExecutorService executor;
+ protected AccountVerification accountVerification;
- public DeliveringInboundStanzaRelay(ResourceRegistry resourceRegistry) {
+ public DeliveringInboundStanzaRelay(ResourceRegistry resourceRegistry, AccountVerification accountVerification) {
this.resourceRegistry = resourceRegistry;
+ this.accountVerification = accountVerification;
int coreThreadCount = 10;
int maxThreadCount = 20;
int threadTimeoutSeconds = 2 * 60 * 1000;
@@ -108,11 +111,14 @@
protected RelayResult deliver() {
List<RelayResult> relayResults = new ArrayList<RelayResult>();
try {
- // TODO look into existing, offline accounts, too - not only online accounts
+ if (!accountVerification.verifyAccountExists(receiver)) {
+ logger.warn("cannot relay to unexisting receiver {} stanza {}", receiver.getFullQualifiedName(), stanza.toString());
+ return new RelayResult(new NoSuchLocalUserException());
+ }
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());
+ logger.warn("cannot relay to offline receiver {} stanza {}", receiver.getFullQualifiedName(), stanza.toString());
+ return new RelayResult(new LocalRecipientOfflineException());
} else {
relayToSessions(relayResults, receivingSessions);
}
Copied: labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/LocalRecipientOfflineException.java (from r755481, labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/LocalRecipientNotReachableException.java)
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/LocalRecipientOfflineException.java?p2=labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/LocalRecipientOfflineException.java&p1=labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/LocalRecipientNotReachableException.java&r1=755481&r2=755842&rev=755842&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/LocalRecipientNotReachableException.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/LocalRecipientOfflineException.java Thu Mar 19 05:59:38 2009
@@ -2,20 +2,20 @@
/**
*/
-public class LocalRecipientNotReachableException extends DeliveryException {
- public LocalRecipientNotReachableException() {
+public class LocalRecipientOfflineException extends DeliveryException {
+ public LocalRecipientOfflineException() {
super();
}
- public LocalRecipientNotReachableException(String string) {
+ public LocalRecipientOfflineException(String string) {
super(string);
}
- public LocalRecipientNotReachableException(String string, Throwable throwable) {
+ public LocalRecipientOfflineException(String string, Throwable throwable) {
super(string, throwable);
}
- public LocalRecipientNotReachableException(Throwable throwable) {
+ public LocalRecipientOfflineException(Throwable throwable) {
super(throwable);
}
}
Added: labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/NoSuchLocalUserException.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/NoSuchLocalUserException.java?rev=755842&view=auto
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/NoSuchLocalUserException.java (added)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/NoSuchLocalUserException.java Thu Mar 19 05:59:38 2009
@@ -0,0 +1,21 @@
+package org.apache.vysper.xmpp.delivery;
+
+/**
+ */
+public class NoSuchLocalUserException extends DeliveryException {
+ public NoSuchLocalUserException() {
+ super();
+ }
+
+ public NoSuchLocalUserException(String string) {
+ super(string);
+ }
+
+ public NoSuchLocalUserException(String string, Throwable throwable) {
+ super(string, throwable);
+ }
+
+ public NoSuchLocalUserException(Throwable throwable) {
+ super(throwable);
+ }
+}
Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/StanzaReceiverRelay.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/StanzaReceiverRelay.java?rev=755842&r1=755841&r2=755842&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/StanzaReceiverRelay.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/StanzaReceiverRelay.java Thu Mar 19 05:59:38 2009
@@ -56,7 +56,7 @@
// TODO needs return here?
}
- throw new LocalRecipientNotReachableException("cannot find receiver " + receiver.getFullQualifiedName());
+ throw new LocalRecipientOfflineException("cannot find receiver " + receiver.getFullQualifiedName());
}
countDelivered++;
Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/failure/ReturnErrorToSenderFailureStrategy.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/failure/ReturnErrorToSenderFailureStrategy.java?rev=755842&r1=755841&r2=755842&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/failure/ReturnErrorToSenderFailureStrategy.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/failure/ReturnErrorToSenderFailureStrategy.java Thu Mar 19 05:59:38 2009
@@ -16,16 +16,16 @@
***********************************************************************/
package org.apache.vysper.xmpp.delivery.failure;
-import org.apache.vysper.xmpp.delivery.DeliveryException;
-import org.apache.vysper.xmpp.delivery.DeliveryFailureStrategy;
-import org.apache.vysper.xmpp.delivery.LocalRecipientNotReachableException;
-import org.apache.vysper.xmpp.delivery.StanzaRelay;
+import org.apache.vysper.xmpp.delivery.*;
import org.apache.vysper.xmpp.server.response.ServerErrorResponses;
-import org.apache.vysper.xmpp.stanza.MessageStanza;
-import org.apache.vysper.xmpp.stanza.Stanza;
-import org.apache.vysper.xmpp.stanza.StanzaErrorCondition;
-import org.apache.vysper.xmpp.stanza.StanzaErrorType;
-import org.apache.vysper.xmpp.stanza.XMPPCoreStanza;
+import org.apache.vysper.xmpp.stanza.*;
+import static org.apache.vysper.xmpp.stanza.PresenceStanzaType.*;
+import org.apache.vysper.xmpp.xmlfragment.XMLElement;
+import org.apache.vysper.xmpp.addressing.Entity;
+import org.apache.vysper.compliance.SpecCompliance;
+import org.apache.vysper.compliance.SpecCompliant;
+import static org.apache.vysper.compliance.SpecCompliant.ComplianceStatus.*;
+import static org.apache.vysper.compliance.SpecCompliant.ComplianceCoverage.*;
/**
*/
@@ -37,6 +37,11 @@
this.stanzaRelay = stanzaRelay;
}
+ @SpecCompliance(compliant = {
+ @SpecCompliant(spec="rfc3921bis-08", section = "8.1", status = FINISHED, coverage = COMPLETE),
+ @SpecCompliant(spec="rfc3921bis-08", section = "8.3.2", status = NOT_STARTED, coverage = UNKNOWN),
+ @SpecCompliant(spec="rfc3921bis-08", section = "4.3", status = NOT_STARTED, coverage = UNKNOWN)
+ })
public void process(Stanza failedToDeliverStanza, DeliveryException deliveryException) throws DeliveryException {
StanzaErrorCondition stanzaErrorCondition = StanzaErrorCondition.SERVICE_UNAVAILABLE;
@@ -51,12 +56,37 @@
}
if (deliveryException != null) {
- if (deliveryException instanceof LocalRecipientNotReachableException) {
+ if (deliveryException instanceof LocalRecipientOfflineException) {
+ // TODO implement 8.2.3 here
stanzaErrorCondition = StanzaErrorCondition.RECIPIENT_UNAVAILABLE;
- if (failedCoreStanza instanceof MessageStanza) {
- // RFC3921bis#8.1
+ if (failedCoreStanza instanceof MessageStanza || failedCoreStanza instanceof IQStanza) {
+ // RFC3921bis#8.1: message and IQ must return service unavailable
stanzaErrorCondition = StanzaErrorCondition.SERVICE_UNAVAILABLE;
}
+ } else if (deliveryException instanceof NoSuchLocalUserException) {
+ // RFC3921bis#8.1: message and IQ must return service unavailable
+ stanzaErrorCondition = StanzaErrorCondition.SERVICE_UNAVAILABLE;
+ if (failedCoreStanza instanceof PresenceStanza) {
+ final PresenceStanzaType presenceStanzaType = ((PresenceStanza) failedCoreStanza).getPresenceType();
+ if (presenceStanzaType == null ||
+ presenceStanzaType == SUBSCRIBED ||
+ presenceStanzaType == UNSUBSCRIBE ||
+ presenceStanzaType == UNSUBSCRIBED ||
+ presenceStanzaType == UNAVAILABLE ||
+ presenceStanzaType == ERROR) {
+ return; // silently ignore
+ }
+ // TODO what happens with PROBE? 8.1 is silent here, but see 4.3
+ if (presenceStanzaType == SUBSCRIBE) {
+ // return UNSUBSCRIBED
+ final Entity from = failedToDeliverStanza.getTo(); // reverse from/to
+ final Entity to = failedToDeliverStanza.getFrom(); // reverse from/to
+ StanzaBuilder builder = StanzaBuilder.createPresenceStanza(from, to, null, UNSUBSCRIBED, null, null);
+ final Stanza finalStanza = builder.getFinalStanza();
+ stanzaRelay.relay(to, finalStanza, IgnoreFailureStrategy.IGNORE_FAILURE_STRATEGY);
+ return;
+ }
+ }
}
}
Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/IQHandler.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/IQHandler.java?rev=755842&r1=755841&r2=755842&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/IQHandler.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/IQHandler.java Thu Mar 19 05:59:38 2009
@@ -29,6 +29,9 @@
import org.apache.vysper.xmpp.xmlfragment.XMLElement;
import org.apache.vysper.xmpp.xmlfragment.XMLElementVerifier;
import org.apache.vysper.compliance.SpecCompliant;
+import org.apache.vysper.compliance.SpecCompliance;
+import static org.apache.vysper.compliance.SpecCompliant.ComplianceCoverage.PARTIAL;
+import static org.apache.vysper.compliance.SpecCompliant.ComplianceStatus.FINISHED;
import java.util.List;
@@ -58,8 +61,11 @@
return firstInnerElement.getVerifier().namespacePresent(namespace);
}
+ @SpecCompliance(compliant = {
+ @SpecCompliant(spec="rfc3920", section="9.2.3", status= FINISHED, coverage = PARTIAL, comment="covers points 1, 2, 5 and 6"),
+ @SpecCompliant(spec="rfc3920bis-09", section="9.2.3", status= FINISHED, coverage = PARTIAL, comment="covers points 1, 2, 5 and 6")
+ })
@Override
- @SpecCompliant(spec="3920", section="9.2.3#1,2,5,6", status=SpecCompliant.ComplianceStatus.FINISHED)
protected Stanza executeCore(XMPPCoreStanza coreStanza, ServerRuntimeContext serverRuntimeContext, boolean isOutboundStanza, SessionContext sessionContext) {
IQStanza stanza = (IQStanza)coreStanza;
Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/compatibility/jabber_iq_auth/handler/AuthCompatibilityIQHandler.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/compatibility/jabber_iq_auth/handler/AuthCompatibilityIQHandler.java?rev=755842&r1=755841&r2=755842&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/compatibility/jabber_iq_auth/handler/AuthCompatibilityIQHandler.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/compatibility/jabber_iq_auth/handler/AuthCompatibilityIQHandler.java Thu Mar 19 05:59:38 2009
@@ -26,10 +26,12 @@
import org.apache.vysper.xmpp.stanza.Stanza;
import org.apache.vysper.xmpp.stanza.StanzaErrorType;
import org.apache.vysper.xmpp.stanza.StanzaErrorCondition;
+import org.apache.vysper.compliance.SpecCompliant;
/**
- * handles bind requests
+ * handles jabber:iq:auth request - by returning "service unavailable"
*/
+@SpecCompliant(spec="xep-0078", status= SpecCompliant.ComplianceStatus.FINISHED, coverage = SpecCompliant.ComplianceCoverage.UNSUPPORTED)
public class AuthCompatibilityIQHandler extends IQHandler {
@Override
@@ -58,10 +60,10 @@
case ERROR:
break; // ignore errors in compatibility only namespace
default:
- new RuntimeException("iq stanza type not supported: " + stanza.getIQType());
+ throw new RuntimeException("iq stanza type not supported: " + stanza.getIQType());
}
return null;
}
-}
\ No newline at end of file
+}
Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceSubscriptionHandler.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceSubscriptionHandler.java?rev=755842&r1=755841&r2=755842&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceSubscriptionHandler.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceSubscriptionHandler.java Thu Mar 19 05:59:38 2009
@@ -18,6 +18,8 @@
package org.apache.vysper.xmpp.modules.core.im.handler;
import org.apache.vysper.compliance.SpecCompliant;
+import org.apache.vysper.compliance.SpecCompliance;
+import static org.apache.vysper.compliance.SpecCompliant.ComplianceStatus.*;
import org.apache.vysper.xmpp.addressing.Entity;
import org.apache.vysper.xmpp.addressing.EntityImpl;
import org.apache.vysper.xmpp.delivery.DeliveryException;
@@ -142,36 +144,10 @@
return null;
}
-/*
-FROM: http://www.xmpp.org/internet-drafts/draft-saintandre-rfc3921bis-05.txt
-
-3.3.3. Server Processing of Inbound Unsubscribe
-
- When the contact's server receives the inbound unsubscribe, it MUST
- modify the subscription state and send a roster push to the contact's
- interested resources, where the subscription state is now either
- "none" or "to" (see Appendix A).
-
- CS: <iq to='juliet@example.com/balcony'
- type='set'
- id='a78b4q6ha467'>
- <query xmlns='jabber:iq:roster'>
- <item jid='romeo@example.net'
- subscription='none'/>
- </query>
- </iq>
-
- CS: <iq to='juliet@example.com/chamber'
- type='set'
- id='a78b4q6ha468'>
- <query xmlns='jabber:iq:roster'>
- <item jid='romeo@example.net'
- subscription='none'/>
- </query>
- </iq>
-
- */
- @SpecCompliant(spec = "RFC3921bis-04", section = "3.3.3")
+ @SpecCompliance(compliant = {
+ @SpecCompliant(spec = "RFC3921bis-05", section = "3.3.3", status = IN_PROGRESS, comment = "current impl based hereupon"),
+ @SpecCompliant(spec = "RFC3921bis-08", section = "3.3.3", status = NOT_STARTED, comment = "substantial additions from bis-05 not yet taken into account")
+ })
protected void handleInboundUnsubscription(PresenceStanza stanza, ServerRuntimeContext serverRuntimeContext, SessionContext sessionContext, ResourceRegistry registry, RosterManager rosterManager) {
Entity contact = stanza.getFrom();
Entity user = stanza.getTo();
@@ -207,51 +183,10 @@
}
-/*
-FROM: http://www.xmpp.org/internet-drafts/draft-saintandre-rfc3921bis-05.txt
-
-3.3.2. Server Processing of Outbound Unsubscribe
-
- As mentioned, the user's server MUST stamp the outbound unsubscribe
- with the bare JID <us...@domain> of the user.
-
- US: <presence from='romeo@example.net'
- to='juliet@example.com'
- type='unsubscribe'/>
-
- If the contact is hosted on the same server, the server MUST adhere
- to the rules specified in the next section when processing the
- unsubscribe.
-
- If the contact is hosted on a different server, the user's server
- then routes the stanza to that foreign domain in accordance with core
- XMPP stanza processing rules.
-
- The user's server then MUST send a roster push with the updated
- roster item to all of the user's interested resources, where the
- subscription state is now either "none" or "from" (see Appendix A).
-
- US: <iq to='romeo@example.net/foo'
- type='set'
- id='h37h3u1bv402'>
- <query xmlns='jabber:iq:roster'>
- <item jid='juliet@example.com'
- subscription='none'/>
- </query>
- </iq>
-
- US: <iq to='romeo@example.net/bar'
- type='set'
- id='h37h3u1bv403'>
- <query xmlns='jabber:iq:roster'>
- <item jid='juliet@example.com'
- subscription='none'/>
- </item>
- </query>
- </iq>
-
- */
- @SpecCompliant(spec = "RFC3921bis-04", section = "3.3.2")
+ @SpecCompliance(compliant = {
+ @SpecCompliant(spec = "RFC3921bis-05", section = "3.3.2", status = IN_PROGRESS, comment = "current impl based hereupon"),
+ @SpecCompliant(spec = "RFC3921bis-08", section = "3.3.2", status = NOT_STARTED, comment = "rephrasing from bis-05 not yet taken into account")
+ })
protected void handleOutboundUnsubscription(PresenceStanza stanza,
ServerRuntimeContext serverRuntimeContext, SessionContext sessionContext, ResourceRegistry registry, RosterManager rosterManager) {
Entity user = stanza.getFrom();
@@ -297,38 +232,10 @@
}
}
- /*
- FROM: http://www.xmpp.org/internet-drafts/draft-saintandre-rfc3921bis-05.txt
-
- 3.2.3. Server Processing of Inbound Subscription Cancellation
-
- When the user's server receives the inbound subscription
- cancellation, it MUST modify the subscription state and send a roster
- push to the user's interested resources, where the subscription state
- is now either "none" or "from" (see Appendix A).
-
- US: <iq to='romeo@example.net/foo'
- type='set'
- id='h37h3u1bv400'>
- <query xmlns='jabber:iq:roster'>
- <item jid='juliet@example.com'
- subscription='none'/>
- </query>
- </iq>
-
- US: <iq to='romeo@example.net/bar'
- type='set'
- id='h37h3u1bv401'>
- <query xmlns='jabber:iq:roster'>
- <item jid='juliet@example.com'
- subscription='none'/>
- </item>
- </query>
- </iq>
-
-
- */
- @SpecCompliant(spec = "RFC3921bis-04", section = "3.2.3")
+ @SpecCompliance(compliant = {
+ @SpecCompliant(spec = "RFC3921bis-05", section = "3.2.3", status = IN_PROGRESS, comment = "current impl based hereupon"),
+ @SpecCompliant(spec = "RFC3921bis-08", section = "3.2.3", status = NOT_STARTED, comment = "additions from bis-05 not yet taken into account")
+ })
protected void handleInboundSubscriptionCancellation(PresenceStanza stanza,
ServerRuntimeContext serverRuntimeContext, SessionContext sessionContext, ResourceRegistry registry, RosterManager rosterManager) {
@@ -365,50 +272,10 @@
}
}
-/*
-3.2.2. Server Processing of Outbound Subscription Cancellation
-
- As mentioned, the contact's server MUST stamp the outbound
- subscription cancellation with the bare JID <co...@domain> of the
- contact.
-
- CS: <presence from='juliet@example.com'
- to='romeo@example.net'
- type='unsubscribed'/>
-
- If the user is hosted on the same server, the server MUST adhere to
- the rules specified in the next section when processing the
- subscription cancellation.
-
- If the user is hosted on a different server, the contact's server
- then routes the stanza to that foreign domain in accordance with core
- XMPP stanza processing rules.
-
- If the user is in the contact's roster, the contact's server then
- MUST send a roster push with the updated roster item to all of the
- contact's interested resources, where the subscription state is now
- either "none" or "to" (see Appendix A).
-
- CS: <iq to='juliet@example.com/balcony'
- type='set'
- id='a78b4q6ha465'>
- <query xmlns='jabber:iq:roster'>
- <item jid='romeo@example.net'
- subscription='none'/>
- </query>
- </iq>
-
- CS: <iq to='juliet@example.com/chamber'
- type='set'
- id='a78b4q6ha466'>
- <query xmlns='jabber:iq:roster'>
- <item jid='romeo@example.net'
- subscription='none'/>
- </query>
- </iq>
-
-*/
- @SpecCompliant(spec = "RFC3921bis-04", section = "3.2.2")
+ @SpecCompliance(compliant = {
+ @SpecCompliant(spec = "RFC3921bis-05", section = "3.2.2", status = IN_PROGRESS, comment = "current impl based hereupon"),
+ @SpecCompliant(spec = "RFC3921bis-08", section = "3.2.2", status = NOT_STARTED, comment = "rephrasing from bis-05 not yet taken into account")
+ })
protected void handleOutboundSubscriptionCancellation(PresenceStanza stanza,
ServerRuntimeContext serverRuntimeContext, SessionContext sessionContext, ResourceRegistry registry, RosterManager rosterManager) {
Entity user = stanza.getFrom();
@@ -441,62 +308,10 @@
}
-/*
-3.1.5. Server Processing of Outbound Subscription Approval
-
- When the contact's client sends the subscription approval, the
- contact's server MUST stamp the outbound stanza with the bare JID
- <co...@domain> of the contact and route or deliver the stanza to
- the user.
-
- CS: <presence from='juliet@example.com'
- to='romeo@example.net'
- type='subscribed'/>
-
- The contact's server then MUST send a roster push to all of the
- contact's interested resources.
-
- CS: <iq to='juliet@example.com/balcony'
- type='set'
- id='a78b4q6ha463'>
- <query xmlns='jabber:iq:roster'>
- <item jid='romeo@example.net'
- subscription='from'/>
- </query>
- </iq>
-
- CS: <iq to='juliet@example.com/chamber'
- type='set'
- id='a78b4q6ha464'>
- <query xmlns='jabber:iq:roster'>
- <item jid='romeo@example.net'
- subscription='from'/>
- </query>
- </iq>
-
- The contact's server MUST then also send current presence to the user
- from each of the contact's available resources.
-
- CS: <presence from='juliet@example.com/balcony'
- to='romeo@example.net'/>
-
- CS: <presence from='juliet@example.com/chamber'
- to='romeo@example.net'/>
-
- From the perspective of the contact, there now exists a subscription
- from the user.
-
- In order to subscribe to the user's presence, the contact would then
- send a subscription request to the user. (XMPP clients will often
- automatically send the subscription request instead of requiring the
- contact to initiate the subscription request, since it is assumed
- that the desired end state is a mutual subscription.) Naturally,
- when the contact sends a subscription request to the user, the
- subscription states will be different from those shown in the
- foregoing examples (see Appendix A) and the roles will be reversed.
-
- */
- @SpecCompliant(spec = "RFC3921bis-04", section = "3.1.5")
+ @SpecCompliance(compliant = {
+ @SpecCompliant(spec = "RFC3921bis-05", section = "3.1.5", status = IN_PROGRESS, comment = "current impl based hereupon"),
+ @SpecCompliant(spec = "RFC3921bis-08", section = "3.1.5", status = NOT_STARTED, comment = "slight changes from bis-05 not yet taken into account")
+ })
protected void handleOutboundSubscriptionApproval(PresenceStanza stanza,
ServerRuntimeContext serverRuntimeContext, SessionContext sessionContext, ResourceRegistry registry, RosterManager rosterManager)
{
@@ -549,76 +364,14 @@
return rosterItem;
}
- /*
- 3.1.6. Server Processing of Inbound Subscription Approval
-
- When the user's server receives the subscription approval, it MUST
- first check if the contact is in the user's roster with a
- subscription='none' or subscription='from' and the 'ask' flag set to
- "subscribe" (i.e., a subscription states of "None + Pending Out" or
- "From + Pending Out"; see Appendix A). If the contact is not in the
- user's roster with either of those states, the user's server MUST
- silently ignore the presence stanza of type "subscribed" (i.e., it
- MUST NOT route it to the user, modify the user's roster, or generate
- a roster push to the user's interested resources).
-
- If the foregoing check is successful, the user's server MUST initiate
- a roster push to all of the user's interested resources, containing
- an updated roster item for the contact with the 'subscription'
- attribute set to a value of "to".
-
- US: <iq to='romeo@example.net/foo'
- type='set'
- id='b89c5r7ib576'>
- <query xmlns='jabber:iq:roster'>
- <item jid='juliet@example.com'
- subscription='to'/>
- </query>
- </iq>
-
- US: <iq to='romeo@example.net/bar'
- type='set'
- id='b89c5r7ib577'>
- <query xmlns='jabber:iq:roster'>
- <item jid='juliet@example.com'
- subscription='to'/>
- </item>
- </query>
- </iq>
-
- From the perspective of the user, there now exists a subscription to
- the contact's presence.
-
- The user's server MUST also deliver the available presence stanza
- received from each of the contact's available resources to each of
- the user's available resources.
-
- [ ... to resource1 ... ]
-
- US: <presence from='juliet@example.com/balcony'
- to='romeo@example.net'/>
-
- [ ... to resource2 ... ]
-
- US: <presence from='juliet@example.com/balcony'
- to='romeo@example.net'/>
-
- [ ... to resource1 ... ]
-
- US: <presence from='juliet@example.com/chamber'
- to='romeo@example.net'/>
-
- [ ... to resource2 ... ]
-
- US: <presence from='juliet@example.com/chamber'
- to='romeo@example.net'/>
-
- */
/**
* TODO this handling method should be optimized to be processed only once for every session
* DeliveringInboundStanzaRelay call this for every resource separately
*/
- @SpecCompliant(spec = "RFC3921bis-04", section = "3.1.6")
+ @SpecCompliance(compliant = {
+ @SpecCompliant(spec = "RFC3921bis-05", section = "3.1.6", status = IN_PROGRESS, comment = "current impl based hereupon"),
+ @SpecCompliant(spec = "RFC3921bis-08", section = "3.1.6", status = NOT_STARTED, comment = "minor rephrasing from bis-05 not yet taken into account")
+ })
protected Stanza handleInboundSubscriptionApproval(PresenceStanza stanza,
ServerRuntimeContext serverRuntimeContext, SessionContext sessionContext, ResourceRegistry registry, RosterManager rosterManager) {
@@ -654,75 +407,10 @@
return null;
}
-/*
-3.1.3. Server Processing of Inbound Subscription Request
-
- The contact's server MUST adhere to the following rules when
- processing the inbound subscription request:
-
- 1. Above all, the contact's server MUST NOT automatically approve
- subscription requests on the contact's behalf; instead, if a
- subscription request requires approval then the contact's server
- MUST deliver that request to the contact's available resource(s)
- for approval or denial by the contact.
- 2. If the contact does not exist, the contact's server MUST
- automatically return a presence stanza of type "unsubscribed" to
- the user.
-
-
- CS: <presence from='juliet@example.com'
- to='romeo@example.net'
- type='unsubscribed'/>
-
- 3. If the contact exists and the user already has a subscription to
- the user's presence, then the contact's server SHOULD auto-reply
- on behalf of the contact by sending a presence stanza of type
- "subscribed" from the contact's bare JID to the user's bare JID.
- If the contact previously sent a presence stanza of type
- "subscribed" and the contact's server treated that as indicating
- "pre-approval" for the user's presence subscription (see
- Appendix A), then the contact's server MAY also auto-reply on
- behalf of the contact.
- 4. If the contact exists, the user does not already have a
- subscription to the contact's presence, and there is at least one
- available resource associated with the contact when the
- subscription request is received by the contact's server, the
- contact's server MUST broadcast that subscription request to all
- available resources in accordance with Server Rules for
- Processing XML Stanzas (Section 8).
- 5. If the contact exists, the user does not already have a
- subscription to the contact's presence, and the contact has no
- available resources when the subscription request is received by
- the contact's server, the contact's server MUST keep a record of
- the complete presence stanza comprising the subscription request,
- including any extended content contained therein, and deliver the
- request when the contact next has an available resource. The
- contact's server MUST continue to deliver the subscription
- request whenever the contact creates an available resource, until
- the contact either approves or denies the request. (Note: The
- contact's server MUST NOT deliver more than one subscription
- request from any given user when the contact next has an
- available resource; e.g., if the user sends multiple subscription
- requests to the contact while the contact is offline, the
- contact's server SHOULD store only one of those requests, such as
- the first request or last request, and MUST deliver only one of
- the requests when the contact next has an available resource;
- this helps to prevent "subscription request spam".)
-
- Note: If the subscription request is directed to a full JID
- <contact@domain/resource> instead of a bare JID <co...@domain>, the
- contact's server SHOULD treat it as if the request had been directed
- to the contact's bare JID. This simplifies processing of presence
- subscriptions.
-
- Note: Until and unless the contact approves the subscription request
- as described under Section 3.1.4, the contact's server MUST NOT add
- an item for the user to the contact's roster.
-
-
-
- */
- @SpecCompliant(spec = "RFC3920bis-04", section = "3.1.3")
+ @SpecCompliance(compliant = {
+ @SpecCompliant(spec = "RFC3921bis-05", section = "3.1.3", status = IN_PROGRESS, comment = "current impl based hereupon"),
+ @SpecCompliant(spec = "RFC3921bis-08", section = "3.1.3", status = NOT_STARTED, comment = "major rephrasing from bis-05 not yet taken into account")
+ })
protected Stanza handleInboundSubscriptionRequest(PresenceStanza stanza,
ServerRuntimeContext serverRuntimeContext, SessionContext sessionContext, ResourceRegistry registry, RosterManager rosterManager) {
Entity contact = stanza.getFrom();
@@ -758,73 +446,10 @@
return null;
}
-/*
-FROM: http://www.xmpp.org/internet-drafts/draft-saintandre-rfc3921bis-05.txt
-
-3.1.2. Server Processing of Outbound Subscription Request
-
- As mentioned, the user's server MUST stamp the outbound subscription
- request with the bare JID <us...@domain> of the user.
-
- US: <presence from='romeo@example.net'
- to='juliet@example.com'
- type='subscribe'/>
-
- Note: If the subscription request is directed to a full JID
- <contact@domain/resource> instead of a bare JID <co...@domain>, the
- user's server SHOULD treat it as if the request had been directed to
- the contact's bare JID and modify the 'to' address accordingly. This
- simplifies processing of presence subscriptions.
-
- If the potential contact is hosted on the same server, the server
- MUST adhere to the rules specified in the next section in processing
- the subscription request and delivering it to the (local) contact.
-
- If the potential contact is hosted on a different server, the user's
- server then routes the stanza to that foreign domain in accordance
- with core XMPP stanza processing rules.
-
- The user's server MUST then send a roster push to all of the user's
- interested resources, containing the potential contact with a
- subscription state of "none" and with notation that the subscription
- is pending (via an 'ask' attribute whose value is "subscribe").
-
- US: <iq to='romeo@example.net/foo'
- type='set'
- id='b89c5r7ib574'>
- <query xmlns='jabber:iq:roster'>
- <item jid='juliet@example.com'
- subscription='none'
- ask='subscribe'/>
- </query>
- </iq>
-
- US: <iq to='romeo@example.net/bar'
- type='set'
- id='b89c5r7ib575'>
- <query xmlns='jabber:iq:roster'>
- <item jid='juliet@example.com'
- subscription='none'
- ask='subscribe'/>
- </item>
- </query>
- </iq>
-
- Note: Because the server must send this roster push, a client MAY
- simply wait for the roster push rather than proactively adding the
- contact to the user's roster before sending the subscription request.
-
- Note: If the contact does not approve or deny the subscription
- request within some configurable amount of time, the user's server
- SHOULD re-send the subscription request to the contact based on an
- implementation-specific algorithm (e.g., whenever a new resource
- becomes available for the user, or after a certain amount of time has
- elapsed); this helps to recover from transient, silent errors that
- may have occurred in relation to the original subscription request.
-
-*/
-
- @SpecCompliant(spec = "RFC3920bis-04", section = "3.1.2")
+ @SpecCompliance(compliant = {
+ @SpecCompliant(spec = "RFC3921bis-05", section = "3.1.2", status = IN_PROGRESS, comment = "current impl based hereupon"),
+ @SpecCompliant(spec = "RFC3921bis-08", section = "3.1.2", status = NOT_STARTED, comment = "major rephrasing from bis-05 not yet taken into account")
+ })
protected void handleOutboundSubscriptionRequest(PresenceStanza stanza,
ServerRuntimeContext serverRuntimeContext, SessionContext sessionContext, ResourceRegistry registry, RosterManager rosterManager) {
StanzaRelay stanzaRelay = serverRuntimeContext.getStanzaRelay();
Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0092_software_version/SoftwareVersionIQHandler.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0092_software_version/SoftwareVersionIQHandler.java?rev=755842&r1=755841&r2=755842&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0092_software_version/SoftwareVersionIQHandler.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0092_software_version/SoftwareVersionIQHandler.java Thu Mar 19 05:59:38 2009
@@ -8,9 +8,11 @@
import org.apache.vysper.xmpp.stanza.IQStanzaType;
import org.apache.vysper.xmpp.stanza.Stanza;
import org.apache.vysper.xmpp.stanza.StanzaBuilder;
+import org.apache.vysper.compliance.SpecCompliant;
/**
*/
+@SpecCompliant(spec="xep-0092", status= SpecCompliant.ComplianceStatus.FINISHED, coverage = SpecCompliant.ComplianceCoverage.COMPLETE)
public class SoftwareVersionIQHandler extends DefaultIQHandler {
public static final String OS_VERSION =
Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/RosterUtils.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/RosterUtils.java?rev=755842&r1=755841&r2=755842&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/RosterUtils.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/RosterUtils.java Thu Mar 19 05:59:38 2009
@@ -25,6 +25,9 @@
import org.apache.vysper.xmpp.xmlfragment.XMLSemanticError;
import org.apache.vysper.xmpp.xmlfragment.Attribute;
import org.apache.vysper.xmpp.xmlfragment.XMLElementVerifier;
+import org.apache.vysper.compliance.SpecCompliant;
+import static org.apache.vysper.compliance.SpecCompliant.ComplianceStatus.FINISHED;
+import static org.apache.vysper.compliance.SpecCompliant.ComplianceCoverage.PARTIAL;
import java.util.List;
import java.util.Map;
@@ -67,6 +70,8 @@
return parseRosterItem(stanza, true); // do also parse subscription types
}
+ @SpecCompliant(spec="rfc3921bis-08", section = "2.1.3", status = FINISHED,
+ coverage = PARTIAL, comment = "handles the conformance rules 1-3 when parseSubscriptionTypes is set to false")
private static RosterItem parseRosterItem(IQStanza stanza, boolean parseSubscriptionTypes) throws RosterBadRequestException, RosterNotAcceptableException {
XMLElement queryElement;
try {
Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/handler/RosterIQHandler.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/handler/RosterIQHandler.java?rev=755842&r1=755841&r2=755842&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/handler/RosterIQHandler.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/handler/RosterIQHandler.java Thu Mar 19 05:59:38 2009
@@ -28,6 +28,10 @@
import org.apache.vysper.xmpp.stanza.*;
import org.apache.vysper.xmpp.state.resourcebinding.ResourceRegistry;
import org.apache.vysper.xmpp.state.resourcebinding.ResourceState;
+import org.apache.vysper.compliance.SpecCompliance;
+import org.apache.vysper.compliance.SpecCompliant;
+import static org.apache.vysper.compliance.SpecCompliant.ComplianceStatus.*;
+import static org.apache.vysper.compliance.SpecCompliant.ComplianceCoverage.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -48,6 +52,7 @@
return verifyInnerElementWorker(stanza, "query");
}
+ @SpecCompliant(spec="rfc3921bis-08", section = "2.1.2", status = FINISHED, coverage = COMPLETE)
@Override
protected Stanza handleGet(IQStanza stanza, ServerRuntimeContext serverRuntimeContext, SessionContext sessionContext) {
@@ -82,34 +87,10 @@
return stanzaBuilder.getFinalStanza();
}
- /*
- 2.1.3. Roster Set
-
-
- A ROSTER SET is a client's request for the server to modify (i.e.,
- create, update, or delete) a roster item; syntactically it is an IQ
- stanza of type "set" sent from client to server and containing a
- <query/> element qualified by the 'jabber:iq:roster' namespace.
-
- The following rules apply to roster sets:
-
- 1. The <query/> element MUST contain one and only one <item/>
- element.
- 2. The server MUST ignore any value of the 'subscription' attribute
- other than "remove" (see Section 2.1.6).
- 3. The server MUST ignore any 'to' address specified on the IQ
- stanza and MUST handle the IQ stanza as if it included no 'to'
- attribute.
-
- C: <iq from='juliet@example.com/balcony'
- id='rs1'
- type='set'>
- <query xmlns='jabber:iq:roster'>
- <item jid='nurse@example.com'/>
- </query>
- </iq>
-
- */
+ @SpecCompliance( compliant = {
+ @SpecCompliant(spec="rfc3921bis-08", section = "2.1.3", status = FINISHED, coverage = COMPLETE),
+ @SpecCompliant(spec="rfc3921bis-08", section = "2.1.6", status = FINISHED, coverage = PARTIAL, comment = "only set-related content applies")
+ })
@Override
protected Stanza handleSet(IQStanza stanza, ServerRuntimeContext serverRuntimeContext, SessionContext sessionContext) {
RosterManager rosterManager = (RosterManager)serverRuntimeContext.getServerRuntimeContextService(RosterManager.SERVER_SERVICE_ROSTERMANAGER);
@@ -141,7 +122,7 @@
if (setRosterItem.getSubscriptionType() == SubscriptionType.REMOVE) {
throw new RuntimeException("roster set REMOVE not yet implemented");
- } /* else: all other subscription types are ignored in a roster set */
+ } /* else: all other subscription types are ignored in a roster set and have been filtered out by RosterUtils.parseRosterItem() */
if (existingItem == null) {
existingItem = new RosterItem(user.getBareJID(), SubscriptionType.NONE);
Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/servicediscovery/handler/DiscoInfoIQHandler.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/servicediscovery/handler/DiscoInfoIQHandler.java?rev=755842&r1=755841&r2=755842&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/servicediscovery/handler/DiscoInfoIQHandler.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/servicediscovery/handler/DiscoInfoIQHandler.java Thu Mar 19 05:59:38 2009
@@ -35,6 +35,7 @@
import org.apache.vysper.xmpp.stanza.StanzaErrorCondition;
import org.apache.vysper.xmpp.stanza.StanzaErrorType;
import org.apache.vysper.xmpp.xmlfragment.XMLElement;
+import org.apache.vysper.compliance.SpecCompliant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -43,6 +44,8 @@
/**
* handles IQ info queries
*/
+@SpecCompliant(spec="xep-0030", status= SpecCompliant.ComplianceStatus.IN_PROGRESS,
+ coverage = SpecCompliant.ComplianceCoverage.PARTIAL, comment = "handles disco info queries")
public class DiscoInfoIQHandler extends DefaultIQHandler {
final Logger logger = LoggerFactory.getLogger(DiscoInfoIQHandler.class);
Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/servicediscovery/handler/DiscoItemIQHandler.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/servicediscovery/handler/DiscoItemIQHandler.java?rev=755842&r1=755841&r2=755842&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/servicediscovery/handler/DiscoItemIQHandler.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/servicediscovery/handler/DiscoItemIQHandler.java Thu Mar 19 05:59:38 2009
@@ -35,6 +35,7 @@
import org.apache.vysper.xmpp.stanza.StanzaErrorCondition;
import org.apache.vysper.xmpp.stanza.StanzaErrorType;
import org.apache.vysper.xmpp.xmlfragment.XMLElement;
+import org.apache.vysper.compliance.SpecCompliant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -43,6 +44,8 @@
/**
* handles IQ info queries
*/
+@SpecCompliant(spec="xep-0030", status= SpecCompliant.ComplianceStatus.IN_PROGRESS,
+ coverage = SpecCompliant.ComplianceCoverage.PARTIAL, comment = "handles disco item queries")
public class DiscoItemIQHandler extends DefaultIQHandler {
final Logger logger = LoggerFactory.getLogger(DiscoItemIQHandler.class);
@@ -121,4 +124,4 @@
return stanzaBuilder.getFinalStanza();
}
-}
\ No newline at end of file
+}
Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/server/DefaultServerRuntimeContext.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/server/DefaultServerRuntimeContext.java?rev=755842&r1=755841&r2=755842&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/server/DefaultServerRuntimeContext.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/server/DefaultServerRuntimeContext.java Thu Mar 19 05:59:38 2009
@@ -32,6 +32,8 @@
import org.apache.vysper.xmpp.state.resourcebinding.ResourceRegistry;
import org.apache.vysper.xmpp.state.presence.LatestPresenceCache;
import org.apache.vysper.xmpp.state.presence.SimplePresenceCache;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.net.ssl.SSLContext;
import java.util.List;
@@ -42,6 +44,8 @@
*/
public class DefaultServerRuntimeContext implements ServerRuntimeContext, ModuleRegistry {
+ final Logger logger = LoggerFactory.getLogger(DefaultServerRuntimeContext.class);
+
// basic internal data structures and configuration...
/**
@@ -208,6 +212,8 @@
public void addModule(Module module) {
+ logger.info("adding module... {} ({})", module.getName(), module.getVersion());
+
List<ServerRuntimeContextService> serviceList = module.getServerServices();
if (serviceList != null) {
for (ServerRuntimeContextService serverRuntimeContextService : serviceList) {
Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/server/ServerMain.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/server/ServerMain.java?rev=755842&r1=755841&r2=755842&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/server/ServerMain.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/server/ServerMain.java Thu Mar 19 05:59:38 2009
@@ -19,6 +19,7 @@
import org.apache.vysper.mina.TCPEndpoint;
import org.apache.vysper.stanzasession.StanzaSessionFactory;
import org.apache.vysper.xmpp.authorization.SimpleUserAuthorization;
+import org.apache.vysper.xmpp.modules.extension.xep0092_software_version.SoftwareVersionModule;
import java.io.File;
@@ -44,7 +45,8 @@
server.addEndpoint(new TCPEndpoint());
server.addEndpoint(new StanzaSessionFactory());
server.setUserAuthorization(userAuthorization);
-
+ server.setAccountVerification(userAuthorization);
+
server.setTLSCertificateInfo(new File("src/main/config/bogus_mina_tls.cert"), "boguspw");
try {
@@ -53,5 +55,7 @@
} catch (Exception e) {
e.printStackTrace();
}
+
+ server.addModule(new SoftwareVersionModule());
}
}
\ No newline at end of file
Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/server/XMPPServer.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/server/XMPPServer.java?rev=755842&r1=755841&r2=755842&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/server/XMPPServer.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/server/XMPPServer.java Thu Mar 19 05:59:38 2009
@@ -20,11 +20,13 @@
import org.apache.vysper.xmpp.authorization.Plain;
import org.apache.vysper.xmpp.authorization.SASLMechanism;
import org.apache.vysper.xmpp.authorization.UserAuthorization;
+import org.apache.vysper.xmpp.authorization.AccountVerification;
import org.apache.vysper.xmpp.delivery.DeliveringInboundStanzaRelay;
import org.apache.vysper.xmpp.delivery.RecordingStanzaRelay;
import org.apache.vysper.xmpp.delivery.StanzaRelayBroker;
import org.apache.vysper.xmpp.modules.roster.RosterModule;
import org.apache.vysper.xmpp.modules.servicediscovery.ServiceDiscoveryModule;
+import org.apache.vysper.xmpp.modules.Module;
import org.apache.vysper.xmpp.protocol.NamespaceHandlerDictionary;
import org.apache.vysper.xmpp.state.resourcebinding.ResourceRegistry;
import org.apache.vysper.xmpp.cryptography.BogusTrustManagerFactory;
@@ -52,6 +54,7 @@
private String serverDomain;
private DefaultServerRuntimeContext serverRuntimeContext;
private UserAuthorization userAuthorization;
+ private AccountVerification accountVerification;
private File tlsCertificateFile;
private String tlsCertificatePassword;
private final List<Endpoint> endpoints = new ArrayList<Endpoint>();
@@ -71,6 +74,10 @@
this.userAuthorization = userAuthorization;
}
+ public void setAccountVerification(AccountVerification accountVerification) {
+ this.accountVerification = accountVerification;
+ }
+
public void setTLSCertificateInfo(File certificate, String password) {
tlsCertificateFile = certificate;
tlsCertificatePassword = password;
@@ -92,7 +99,7 @@
ResourceRegistry resourceRegistry = new ResourceRegistry();
- DeliveringInboundStanzaRelay internalStanzaRelay = new DeliveringInboundStanzaRelay(resourceRegistry);
+ DeliveringInboundStanzaRelay internalStanzaRelay = new DeliveringInboundStanzaRelay(resourceRegistry, accountVerification);
RecordingStanzaRelay externalStanzaRelay = new RecordingStanzaRelay();
StanzaRelayBroker stanzaRelayBroker = new StanzaRelayBroker();
@@ -125,6 +132,10 @@
endpoint.stop();
}
}
+
+ public void addModule(Module module) {
+ serverRuntimeContext.addModule(module);
+ }
private void addCoreDictionaries(List<NamespaceHandlerDictionary> dictionaries) {
dictionaries.add(new org.apache.vysper.xmpp.modules.core.base.BaseStreamStanzaDictionary());
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=755842&r1=755841&r2=755842&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 Thu Mar 19 05:59:38 2009
@@ -60,9 +60,9 @@
SASLAuthentication saslAuthentication = connection.getSASLAuthentication();
// saslAuthentication.authenticateAnonymously();
-// saslAuthentication.authenticate("user1@vysper.org", "password1", "test");
+ saslAuthentication.authenticate("user1@vysper.org", "password1", "test");
-// if (!saslAuthentication.isAuthenticated()) return;
+ if (!saslAuthentication.isAuthenticated()) return;
connection.login(me + "@vysper.org", "password1");
Modified: labs/vysper/src/test/java/org/apache/vysper/xmpp/delivery/DeliveringStanzaRelayTestCase.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/test/java/org/apache/vysper/xmpp/delivery/DeliveringStanzaRelayTestCase.java?rev=755842&r1=755841&r2=755842&view=diff
==============================================================================
--- labs/vysper/src/test/java/org/apache/vysper/xmpp/delivery/DeliveringStanzaRelayTestCase.java (original)
+++ labs/vysper/src/test/java/org/apache/vysper/xmpp/delivery/DeliveringStanzaRelayTestCase.java Thu Mar 19 05:59:38 2009
@@ -21,10 +21,12 @@
import org.apache.vysper.xmpp.server.SessionState;
import org.apache.vysper.xmpp.addressing.EntityImpl;
import org.apache.vysper.xmpp.addressing.EntityFormatException;
+import org.apache.vysper.xmpp.addressing.Entity;
import org.apache.vysper.xmpp.stanza.StanzaBuilder;
import org.apache.vysper.xmpp.stanza.Stanza;
import org.apache.vysper.xmpp.xmlfragment.XMLSemanticError;
import org.apache.vysper.xmpp.delivery.failure.IgnoreFailureStrategy;
+import org.apache.vysper.xmpp.authorization.AccountVerification;
import junit.framework.TestCase;
/**
@@ -32,8 +34,23 @@
public class DeliveringStanzaRelayTestCase extends TestCase {
protected ResourceRegistry resourceRegistry = new ResourceRegistry();
- protected DeliveringInboundStanzaRelay stanzaRelay = new DeliveringInboundStanzaRelay(resourceRegistry);
-
+ protected AccountVerification accountVerification;
+ protected DeliveringInboundStanzaRelay stanzaRelay;
+
+ static class AccountVerificationMock implements AccountVerification {
+ public boolean verifyAccountExists(Entity jid) {
+ return true;
+ }
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ accountVerification = new AccountVerificationMock();
+ stanzaRelay = new DeliveringInboundStanzaRelay(resourceRegistry, accountVerification);
+ }
+
public void testSimpleRelay() throws EntityFormatException, XMLSemanticError, DeliveryException {
EntityImpl fromEntity = EntityImpl.parse("userFrom@vysper.org");
EntityImpl toEntity = EntityImpl.parse("userTo@vysper.org");
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org