From 714db85681c5df070fdd241107b1cee7eb71b35f Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 23 Apr 2014 16:40:14 +0200 Subject: [PATCH] INT-3383: Update to Smack 4.0.0 JIRA: https://jira.spring.io/browse/INT-3383 The family of Message.(set|get)Properties methods has been factored out of Smack as an extra extension. Use JivePropertiesManager as replacement. It is no longer necessary to supress Smack path warnings. Delete custom smack-config.xml, as all it did was disabling certain (important) SASL mechanisms. Also remove the unit test that verified this. Some unit tests mock ChatManager and Chat for no reason, delete those lines. XMPPConnection.getHost() and .getPort() are only valid after the connection got established, due the fact that those information is often only available after a DNS SRV lookup was performed. Remove the lines in unit tests that verified their value. Remove the truststorePath example in documentation, since Smack 4.0 no longer provides support for providing a custom truststore. Instead ConnectionConfiguration in Smack 4.0 allows to set a custom SSLContext (which then again can provide a TrustManager that uses a custom truststore). --- build.gradle | 15 +++--- .../ws/config/UriVariableTests.java | 2 +- .../config/XmppConnectionFactoryBean.java | 49 ++++++++++++++----- .../xmpp/support/DefaultXmppHeaderMapper.java | 31 ++++++------ .../main/resources/META-INF/smack-config.xml | 24 --------- ...ssageInboundChannelAdapterParserTests.java | 17 +++---- ...sageOutboundChannelAdapterParserTests.java | 6 ++- .../config/XmppConnectionParserTests.java | 31 +++--------- .../ChatMessageListeningEndpointTests.java | 16 +++--- .../PresenceListeningEndpointTests.java | 7 --- .../support/DefaultXmppHeaderMapperTests.java | 32 ++++++------ src/reference/docbook/xmpp.xml | 3 +- 12 files changed, 100 insertions(+), 133 deletions(-) delete mode 100644 spring-integration-xmpp/src/main/resources/META-INF/smack-config.xml diff --git a/build.gradle b/build.gradle index 6c70b7f989..84542a21df 100644 --- a/build.gradle +++ b/build.gradle @@ -107,7 +107,8 @@ subprojects { subproject -> saajImplVersion = '1.3.23' servletApiVersion = '3.1.0' slf4jVersion = "1.7.6" - smackVersion = '3.2.1' + smack3Version = '3.2.1' + smackVersion = '4.0.0' springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '1.3.4.RELEASE' springDataMongoVersion = '1.5.0.RELEASE' springDataRedisVersion = '1.3.0.RELEASE' @@ -636,8 +637,8 @@ project('spring-integration-ws') { exclude group: 'org.springframework' } testCompile "javax.jms:jms-api:$jmsApiVersion" - testCompile "org.igniterealtime.smack:smack:$smackVersion" - testCompile "org.igniterealtime.smack:smackx:$smackVersion" + testCompile "org.igniterealtime.smack:smack:$smack3Version" + testCompile "org.igniterealtime.smack:smackx:$smack3Version" testCompile "javax.mail:javax.mail-api:$javaxMailVersion" testRuntime "com.sun.mail:mailapi:$javaxMailVersion" } @@ -667,14 +668,12 @@ project('spring-integration-xmpp') { dependencies { compile project(":spring-integration-core") compile("javax.activation:activation:$javaxActivationVersion", optional) - compile "org.igniterealtime.smack:smack:$smackVersion" - compile "org.igniterealtime.smack:smackx:$smackVersion" + compile "org.igniterealtime.smack:smack-tcp:$smackVersion" + compile "org.igniterealtime.smack:smack-resolver-javax:$smackVersion" + compile "org.igniterealtime.smack:smack-extensions:$smackVersion" compile "org.springframework:spring-context-support:$springVersion" testCompile project(":spring-integration-stream") } - - // suppress smack path warnings - [compileJava,compileTestJava]*.options*.compilerArgs = ["${xLintArg},-path"] } project("spring-integration-bom") { diff --git a/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/UriVariableTests.java b/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/UriVariableTests.java index 75ddb6b1b2..1f9b65a605 100644 --- a/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/UriVariableTests.java +++ b/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/UriVariableTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 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. diff --git a/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/config/XmppConnectionFactoryBean.java b/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/config/XmppConnectionFactoryBean.java index 7619262c4a..07ff32d15c 100644 --- a/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/config/XmppConnectionFactoryBean.java +++ b/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/config/XmppConnectionFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2014 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. @@ -19,7 +19,9 @@ package org.springframework.integration.xmpp.config; import org.jivesoftware.smack.ConnectionConfiguration; import org.jivesoftware.smack.ConnectionListener; import org.jivesoftware.smack.Roster; +import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.XMPPConnection; +import org.jivesoftware.smack.tcp.XMPPTCPConnection; import org.springframework.beans.factory.BeanInitializationException; import org.springframework.beans.factory.config.AbstractFactoryBean; import org.springframework.context.SmartLifecycle; @@ -27,29 +29,31 @@ import org.springframework.util.Assert; import org.springframework.util.StringUtils; /** - * This class configures an {@link org.jivesoftware.smack.XMPPConnection} object. + * This class configures an {@link org.jivesoftware.smack.XMPPConnection} object. * This object is used for all scenarios to talk to a Smack server. * * @author Josh Long * @author Mark Fisher * @author Oleg Zhurakousky + * @author Florian Schmaus + * * @see org.jivesoftware.smack.XMPPConnection * @since 2.0 */ public class XmppConnectionFactoryBean extends AbstractFactoryBean implements SmartLifecycle{ private final ConnectionConfiguration connectionConfiguration; - + private volatile String resource = null; // server will generate resource if not provided - + private volatile String user; - + private volatile String password; - + private volatile String subscriptionMode = "accept_all"; - + private volatile XMPPConnection connection; - + private volatile boolean autoStartup = true; private volatile int phase = Integer.MIN_VALUE; @@ -69,6 +73,10 @@ public class XmppConnectionFactoryBean extends AbstractFactoryBean getObjectType() { return XMPPConnection.class; @@ -92,7 +100,7 @@ public class XmppConnectionFactoryBean extends AbstractFactoryBean implements XmppHeaderMapper { - + private static final List STANDARD_HEADER_NAMES = new ArrayList(); static { @@ -49,17 +52,6 @@ public class DefaultXmppHeaderMapper extends AbstractHeaderMapper imple @Override protected Map extractStandardHeaders(Message source) { Map headers = new HashMap(); - /*Collection extensions = source.getExtensions(); - if (!CollectionUtils.isEmpty(extensions)) { - for (PacketExtension extension : extensions) { - String name = extension.getElementName(); - String namespace = extension.getNamespace(); - if (StringUtils.hasText(namespace)) { - name = namespace + ":" + name; - } - headers.put(name, extension.toXML()); - } - }*/ String from = source.getFrom(); if (StringUtils.hasText(from)) { headers.put(XmppHeaders.FROM, from); @@ -86,8 +78,12 @@ public class DefaultXmppHeaderMapper extends AbstractHeaderMapper imple @Override protected Map extractUserDefinedHeaders(Message source) { Map headers = new HashMap(); - for (String propertyName : source.getPropertyNames()) { - headers.put(propertyName, source.getProperty(propertyName)); + JivePropertiesExtension jpe = (JivePropertiesExtension) source.getExtension(JivePropertiesExtension.NAMESPACE); + if (jpe == null) { + return headers; + } + for (String propertyName : jpe.getPropertyNames()) { + headers.put(propertyName, JivePropertiesManager.getProperty(source, propertyName)); } return headers; } @@ -129,7 +125,7 @@ public class DefaultXmppHeaderMapper extends AbstractHeaderMapper imple @Override protected void populateUserDefinedHeader(String headerName, Object headerValue, Message target) { - target.setProperty(headerName, headerValue); + JivePropertiesManager.addProperty(target, headerName, headerValue); } @Override @@ -145,4 +141,5 @@ public class DefaultXmppHeaderMapper extends AbstractHeaderMapper imple protected String getStandardHeaderPrefix() { return XmppHeaders.PREFIX; } + } diff --git a/spring-integration-xmpp/src/main/resources/META-INF/smack-config.xml b/spring-integration-xmpp/src/main/resources/META-INF/smack-config.xml deleted file mode 100644 index 09b7da5422..0000000000 --- a/spring-integration-xmpp/src/main/resources/META-INF/smack-config.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - org.jivesoftware.smackx.ServiceDiscoveryManager - org.jivesoftware.smack.PrivacyListManager - org.jivesoftware.smackx.XHTMLManager - org.jivesoftware.smackx.muc.MultiUserChat - org.jivesoftware.smackx.filetransfer.FileTransferManager - org.jivesoftware.smackx.LastActivityManager - org.jivesoftware.smack.ReconnectionManager - org.jivesoftware.smackx.commands.AdHocCommandManager - - - - 5000 - - - 30000 - - PLAIN - \ No newline at end of file diff --git a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/ChatMessageInboundChannelAdapterParserTests.java b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/ChatMessageInboundChannelAdapterParserTests.java index 8e1f852d52..0ca4593afd 100644 --- a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/ChatMessageInboundChannelAdapterParserTests.java +++ b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/ChatMessageInboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 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. @@ -22,11 +22,11 @@ import static org.junit.Assert.assertSame; import java.lang.reflect.Field; -import org.jivesoftware.smack.Chat; -import org.jivesoftware.smack.ChatManager; import org.jivesoftware.smack.PacketListener; +import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.packet.Message; +import org.jivesoftware.smackx.jiveproperties.JivePropertiesManager; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; @@ -47,6 +47,7 @@ import org.springframework.util.ReflectionUtils; * @author Oleg Zhurakousky * @author Mark Fisher * @author Gunnar Hillert + * @author Florian Schmaus */ @ContextConfiguration @RunWith(SpringJUnit4ClassRunner.class) @@ -78,12 +79,8 @@ public class ChatMessageInboundChannelAdapterParserTests { } @Test - public void testInboundAdapterUsageWithHeaderMapper() { + public void testInboundAdapterUsageWithHeaderMapper() throws NotConnectedException { XMPPConnection xmppConnection = Mockito.mock(XMPPConnection.class); - ChatManager chatManager = Mockito.mock(ChatManager.class); - Mockito.when(xmppConnection.getChatManager()).thenReturn(chatManager); - Chat chat = Mockito.mock(Chat.class); - Mockito.when(chatManager.getThreadChat(Mockito.any(String.class))).thenReturn(chat); ChatMessageListeningEndpoint adapter = context.getBean("xmppInboundAdapter", ChatMessageListeningEndpoint.class); @@ -96,8 +93,8 @@ public class ChatMessageInboundChannelAdapterParserTests { Message message = new Message(); message.setBody("hello"); message.setTo("oleg"); - message.setProperty("foo", "foo"); - message.setProperty("bar", "bar"); + JivePropertiesManager.addProperty(message, "foo", "foo"); + JivePropertiesManager.addProperty(message, "bar", "bar"); packetListener.processPacket(message); org.springframework.messaging.Message siMessage = xmppInbound.receive(0); assertEquals("foo", siMessage.getHeaders().get("foo")); diff --git a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/ChatMessageOutboundChannelAdapterParserTests.java b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/ChatMessageOutboundChannelAdapterParserTests.java index 7facc683b5..50ae3d53a4 100644 --- a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/ChatMessageOutboundChannelAdapterParserTests.java +++ b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/ChatMessageOutboundChannelAdapterParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 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. @@ -24,6 +24,7 @@ import static org.mockito.Mockito.verify; import java.util.List; import org.jivesoftware.smack.XMPPConnection; +import org.jivesoftware.smackx.jiveproperties.JivePropertiesManager; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; @@ -53,6 +54,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; * @author Mark Fisher * @author Artem Bilan * @author Gunnar Hillert + * @author Florian Schmaus */ @ContextConfiguration @RunWith(SpringJUnit4ClassRunner.class) @@ -117,7 +119,7 @@ public class ChatMessageOutboundChannelAdapterParserTests { Object[] args = invocation.getArguments(); org.jivesoftware.smack.packet.Message xmppMessage = (org.jivesoftware.smack.packet.Message) args[0]; assertEquals("oleg", xmppMessage.getTo()); - assertEquals("foobar", xmppMessage.getProperty("foobar")); + assertEquals("foobar", JivePropertiesManager.getProperty(xmppMessage, "foobar")); return null; }}) .when(connection).sendPacket(Mockito.any(org.jivesoftware.smack.packet.Message.class)); diff --git a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/XmppConnectionParserTests.java b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/XmppConnectionParserTests.java index 7f474f4fbd..6a9f9bd2f3 100644 --- a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/XmppConnectionParserTests.java +++ b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/XmppConnectionParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 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. @@ -21,9 +21,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertNull; -import java.util.List; - -import org.jivesoftware.smack.SmackConfiguration; import org.jivesoftware.smack.XMPPConnection; import org.junit.Test; import org.springframework.context.ApplicationContext; @@ -34,28 +31,16 @@ import org.springframework.integration.test.util.TestUtils; * @author Oleg Zhurakousky * @author Gary Russell * @author Gunnar Hillert + * @author Florian Schmaus */ public class XmppConnectionParserTests { - @Test - public void testSmackSasl() { - /* - * Possible SASL mechanisms - * EXTERNAL, GSSAPI, DIGEST-MD5, CRAM-MD5, PLAIN, ANONYMOUS - */ - // values are set in META-INF/smack-config.xml - List saslMechNames = SmackConfiguration.getSaslMechs(); - assertEquals(2, saslMechNames.size()); - assertEquals("PLAIN", saslMechNames.get(0)); - } - @Test public void testSimpleConfiguration() { - ApplicationContext ac = new ClassPathXmlApplicationContext("XmppConnectionParserTests-simple.xml", this.getClass()); + ApplicationContext ac = + new ClassPathXmlApplicationContext("XmppConnectionParserTests-simple.xml", this.getClass()); XMPPConnection connection = ac.getBean("connection", XMPPConnection.class); assertEquals("localhost", connection.getServiceName()); - assertEquals("localhost", connection.getHost()); - assertEquals(5222, connection.getPort()); assertFalse(connection.isConnected()); XmppConnectionFactoryBean xmppFb = ac.getBean("&connection", XmppConnectionFactoryBean.class); assertEquals("happy.user", TestUtils.getPropertyValue(xmppFb, "user")); @@ -69,17 +54,17 @@ public class XmppConnectionParserTests { @Test public void testDefaultConnectionName() { - ApplicationContext ac = new ClassPathXmlApplicationContext("XmppConnectionParserTests-simple.xml", this.getClass()); + ApplicationContext ac = + new ClassPathXmlApplicationContext("XmppConnectionParserTests-simple.xml", this.getClass()); assertTrue(ac.containsBean("xmppConnection")); } @Test public void testCompleteConfiguration() { - ApplicationContext ac = new ClassPathXmlApplicationContext("XmppConnectionParserTests-complete.xml", this.getClass()); + ApplicationContext ac = + new ClassPathXmlApplicationContext("XmppConnectionParserTests-complete.xml", this.getClass()); XMPPConnection connection = ac.getBean("connection", XMPPConnection.class); assertEquals("foogle.com", connection.getServiceName()); - assertEquals("localhost", connection.getHost()); - assertEquals(6222, connection.getPort()); assertFalse(connection.isConnected()); XmppConnectionFactoryBean xmppFb = ac.getBean("&connection", XmppConnectionFactoryBean.class); assertEquals("happy.user", TestUtils.getPropertyValue(xmppFb, "user")); diff --git a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/inbound/ChatMessageListeningEndpointTests.java b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/inbound/ChatMessageListeningEndpointTests.java index 293b398cc3..705f431c1f 100644 --- a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/inbound/ChatMessageListeningEndpointTests.java +++ b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/inbound/ChatMessageListeningEndpointTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 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. @@ -13,24 +13,24 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.integration.xmpp.inbound; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; import java.util.HashSet; import java.util.Set; -import org.jivesoftware.smack.Chat; -import org.jivesoftware.smack.ChatManager; import org.jivesoftware.smack.PacketListener; +import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.filter.PacketFilter; import org.jivesoftware.smack.packet.Message; import org.junit.Test; + import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; @@ -49,6 +49,7 @@ import org.springframework.messaging.support.ErrorMessage; /** * @author Oleg Zhurakousky * @author Gunnar Hillert + * @author Florian Schmaus * */ public class ChatMessageListeningEndpointTests { @@ -114,16 +115,11 @@ public class ChatMessageListeningEndpointTests { } @Test - public void testWithErrorChannel(){ + public void testWithErrorChannel() throws NotConnectedException{ DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); XMPPConnection connection = mock(XMPPConnection.class); bf.registerSingleton(XmppContextUtils.XMPP_CONNECTION_BEAN_NAME, connection); - ChatManager cm = mock(ChatManager.class); - when(connection.getChatManager()).thenReturn(cm); - Chat chat = mock(Chat.class); - when(cm.getThreadChat(Mockito.anyString())).thenReturn(chat); - ChatMessageListeningEndpoint endpoint = new ChatMessageListeningEndpoint(); DirectChannel outChannel = new DirectChannel(); diff --git a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/inbound/PresenceListeningEndpointTests.java b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/inbound/PresenceListeningEndpointTests.java index d3fe596c74..4223b2aae8 100644 --- a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/inbound/PresenceListeningEndpointTests.java +++ b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/inbound/PresenceListeningEndpointTests.java @@ -25,8 +25,6 @@ import static org.mockito.Mockito.when; import java.util.HashSet; import java.util.Set; -import org.jivesoftware.smack.Chat; -import org.jivesoftware.smack.ChatManager; import org.jivesoftware.smack.Roster; import org.jivesoftware.smack.RosterListener; import org.jivesoftware.smack.XMPPConnection; @@ -138,11 +136,6 @@ public class PresenceListeningEndpointTests { XMPPConnection connection = mock(XMPPConnection.class); bf.registerSingleton(XmppContextUtils.XMPP_CONNECTION_BEAN_NAME, connection); - ChatManager cm = mock(ChatManager.class); - when(connection.getChatManager()).thenReturn(cm); - Chat chat = mock(Chat.class); - when(cm.getThreadChat(Mockito.anyString())).thenReturn(chat); - PresenceListeningEndpoint endpoint = new PresenceListeningEndpoint(); DirectChannel outChannel = new DirectChannel(); diff --git a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/support/DefaultXmppHeaderMapperTests.java b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/support/DefaultXmppHeaderMapperTests.java index 4cd1a6201d..504df73feb 100644 --- a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/support/DefaultXmppHeaderMapperTests.java +++ b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/support/DefaultXmppHeaderMapperTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2014 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. @@ -23,14 +23,14 @@ import java.util.HashMap; import java.util.Map; import org.jivesoftware.smack.packet.Message; - +import org.jivesoftware.smackx.jiveproperties.JivePropertiesManager; import org.junit.Test; - import org.springframework.messaging.MessageHeaders; import org.springframework.integration.xmpp.XmppHeaders; /** * @author Mark Fisher + * @author Florian Schmaus * @since 2.1 */ public class DefaultXmppHeaderMapperTests { @@ -58,12 +58,12 @@ public class DefaultXmppHeaderMapperTests { assertEquals(Message.Type.headline, target.getType()); // user-defined headers not included by default - assertNull(target.getProperty("userDefined1")); - assertNull(target.getProperty("userDefined2")); + assertNull(JivePropertiesManager.getProperty(target, "userDefined1")); + assertNull(JivePropertiesManager.getProperty(target, "userDefined2")); // transient headers should not be copied - assertNull(target.getProperty("id")); - assertNull(target.getProperty("timestamp")); + assertNull(JivePropertiesManager.getProperty(target, "id")); + assertNull(JivePropertiesManager.getProperty(target, "timestamp")); } @Test @@ -91,15 +91,15 @@ public class DefaultXmppHeaderMapperTests { assertEquals(Message.Type.normal, target.getType()); // user-defined headers are included if in the list - assertEquals("foo", target.getProperty("userDefined1")); - assertEquals("bar", target.getProperty("userDefined2")); + assertEquals("foo", JivePropertiesManager.getProperty(target, "userDefined1")); + assertEquals("bar", JivePropertiesManager.getProperty(target, "userDefined2")); // user-defined headers are not included if not in the list - assertNull(target.getProperty("userDefined3")); + assertNull(JivePropertiesManager.getProperty(target, "userDefined3")); // transient headers should not be copied - assertNull(target.getProperty("id")); - assertNull(target.getProperty("timestamp")); + assertNull(JivePropertiesManager.getProperty(target, "id")); + assertNull(JivePropertiesManager.getProperty(target, "timestamp")); } @Test @@ -109,8 +109,8 @@ public class DefaultXmppHeaderMapperTests { source.setFrom("test.from"); source.setSubject("test.subject"); source.setThread("test.thread"); - source.setProperty("userDefined1", "foo"); - source.setProperty("userDefined2", "bar"); + JivePropertiesManager.addProperty(source, "userDefined1", "foo"); + JivePropertiesManager.addProperty(source, "userDefined2", "bar"); Map headers = mapper.toHeadersFromRequest(source); assertEquals("test.to", headers.get(XmppHeaders.TO)); assertEquals("test.from", headers.get(XmppHeaders.FROM)); @@ -129,8 +129,8 @@ public class DefaultXmppHeaderMapperTests { source.setFrom("test.from"); source.setSubject("test.subject"); source.setThread("test.thread"); - source.setProperty("userDefined1", "foo"); - source.setProperty("userDefined2", "bar"); + JivePropertiesManager.addProperty(source, "userDefined1", "foo"); + JivePropertiesManager.addProperty(source, "userDefined2", "bar"); Map headers = mapper.toHeadersFromReply(source); assertNull(headers.get(XmppHeaders.TO)); assertNull(headers.get(XmppHeaders.FROM)); diff --git a/src/reference/docbook/xmpp.xml b/src/reference/docbook/xmpp.xml index d3b8156603..a8d196e618 100644 --- a/src/reference/docbook/xmpp.xml +++ b/src/reference/docbook/xmpp.xml @@ -205,7 +205,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/integration/xmpp Advanced Configuration - Since Spring Integration XMPP support is based on the Smack 3.1 API (http://www.igniterealtime.org/downloads/index.jsp), it is important + Since Spring Integration XMPP support is based on the Smack 4.0 API (http://www.igniterealtime.org/projects/smack/), it is important to know a few details related to more complex configuration of the XMPP Connection object. @@ -221,7 +221,6 @@ xsi:schemaLocation="http://www.springframework.org/schema/integration/xmpp -