Fix XMPP module after downgrading Smack library

This commit is contained in:
Artem Bilan
2024-04-16 15:57:08 -04:00
parent 6f34d6839e
commit 7a7cb2b792
2 changed files with 5 additions and 5 deletions

View File

@@ -22,8 +22,8 @@ import java.util.Map;
import org.jivesoftware.smack.StanzaListener;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.filter.StanzaFilter;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.packet.XmlElement;
import org.springframework.expression.EvaluationContext;
import org.springframework.expression.Expression;
@@ -132,9 +132,9 @@ public class ChatMessageListeningEndpoint extends AbstractXmppConnectionAwareEnd
if (ChatMessageListeningEndpoint.this.payloadExpression != null) {
EvaluationContext evaluationContextToUse = ChatMessageListeningEndpoint.this.evaluationContext;
List<XmlElement> extensions = xmppMessage.getExtensions();
List<ExtensionElement> extensions = xmppMessage.getExtensions();
if (extensions.size() == 1) {
XmlElement extension = extensions.get(0);
ExtensionElement extension = extensions.get(0);
evaluationContextToUse = ExpressionUtils.createStandardEvaluationContext(getBeanFactory());
evaluationContextToUse.setVariable("extension", extension);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -82,7 +82,7 @@ public class ChatMessageInboundChannelAdapterParserTests {
assertThat(TestUtils.getPropertyValue(adapter, "payloadExpression.expression")).isEqualTo("#root");
adapter.start();
Map asyncRecvListeners = TestUtils.getPropertyValue(connection, "asyncRecvListeners", Map.class);
assertThat(asyncRecvListeners.size()).isEqualTo(6);
assertThat(asyncRecvListeners.size()).isEqualTo(5);
Object lastListener = asyncRecvListeners.values().stream().reduce((first, second) -> second).get();
assertThat(TestUtils.getPropertyValue(lastListener, "packetFilter")).isSameAs(stanzaFilter);
adapter.stop();