renaming components

This commit is contained in:
Mark Fisher
2010-11-13 12:09:56 -05:00
parent c0d9a9a02c
commit 0c14957a3e
23 changed files with 143 additions and 143 deletions

View File

@@ -24,17 +24,17 @@ import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
/**
* Parser for 'message-inbound-channel-adapter' element
* Parser for the XMPP 'inbound-channel-adapter' element.
*
* @author Josh Long
* @author Oleg Zhurakousky
* @since 2.0
*/
public class XmppMessageInboundEndpointParser extends AbstractSingleBeanDefinitionParser {
public class ChatMessageInboundChannelAdapterParser extends AbstractSingleBeanDefinitionParser {
@Override
protected String getBeanClassName(Element element) {
return "org.springframework.integration.xmpp.inbound.XmppMessageDrivenEndpoint";
return "org.springframework.integration.xmpp.inbound.ChatMessageListeningEndpoint";
}
@Override

View File

@@ -23,17 +23,17 @@ import org.springframework.integration.config.xml.AbstractOutboundChannelAdapter
import org.w3c.dom.Element;
/**
* Parser for 'xmpp:message-outbound-channel-adapter' element
* Parser for the XMPP 'outbound-channel-adapter' element
*
* @author Oleg Zhurakousky
* @since 2.0
*/
public class XmppMessageOutboundEndpointParser extends AbstractOutboundChannelAdapterParser {
public class ChatMessageOutboundChannelAdapterParser extends AbstractOutboundChannelAdapterParser {
@Override
protected AbstractBeanDefinition parseConsumer(Element element, ParserContext parserContext) {
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(
"org.springframework.integration.xmpp.outbound.XmppMessageSendingMessageHandler");
"org.springframework.integration.xmpp.outbound.ChatMessageSendingMessageHandler");
String connectionName = element.getAttribute("xmpp-connection");
builder.addConstructorArgReference(connectionName);
return builder.getBeanDefinition();

View File

@@ -29,11 +29,11 @@ import org.w3c.dom.Element;
* @author Oleg Zhurakousky
* @since 2.0
*/
public class XmppRosterListeningEndpointParser extends AbstractSingleBeanDefinitionParser {
public class PresenceInboundChannelAdapterParser extends AbstractSingleBeanDefinitionParser {
@Override
protected String getBeanClassName(Element element) {
return "org.springframework.integration.xmpp.inbound.XmppRosterListeningEndpoint";
return "org.springframework.integration.xmpp.inbound.RosterListeningEndpoint";
}
@Override

View File

@@ -33,7 +33,7 @@ public class PresenceOutboundChannelAdapterParser extends AbstractOutboundChanne
@Override
protected AbstractBeanDefinition parseConsumer(Element element, ParserContext parserContext) {
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(
"org.springframework.integration.xmpp.outbound.XmppPresenceSendingMessageHandler");
"org.springframework.integration.xmpp.outbound.PresenceSendingMessageHandler");
String connectionName = element.getAttribute("xmpp-connection");
builder.addConstructorArgReference(connectionName);
return builder.getBeanDefinition();

View File

@@ -33,11 +33,11 @@ public class XmppNamespaceHandler extends NamespaceHandlerSupport {
registerBeanDefinitionParser("xmpp-connection", new XmppConnectionParser());
// send/receive messages
registerBeanDefinitionParser("message-inbound-channel-adapter", new XmppMessageInboundEndpointParser());
registerBeanDefinitionParser("message-outbound-channel-adapter", new XmppMessageOutboundEndpointParser());
registerBeanDefinitionParser("inbound-channel-adapter", new ChatMessageInboundChannelAdapterParser());
registerBeanDefinitionParser("outbound-channel-adapter", new ChatMessageOutboundChannelAdapterParser());
// presence
registerBeanDefinitionParser("roster-event-inbound-channel-adapter", new XmppRosterListeningEndpointParser());
registerBeanDefinitionParser("presence-inbound-channel-adapter", new PresenceInboundChannelAdapterParser());
registerBeanDefinitionParser("presence-outbound-channel-adapter", new PresenceOutboundChannelAdapterParser());
registerBeanDefinitionParser("header-enricher", new XmppHeaderEnricherParser());

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.xmpp;
package org.springframework.integration.xmpp.core;
import org.jivesoftware.smack.XMPPConnection;
import org.springframework.beans.factory.BeanFactory;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.xmpp;
package org.springframework.integration.xmpp.core;
import org.jivesoftware.smack.XMPPConnection;
import org.springframework.beans.factory.BeanFactory;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.xmpp;
package org.springframework.integration.xmpp.core;
/**
* @author Oleg ZHurakousky

View File

@@ -25,8 +25,8 @@ import org.jivesoftware.smack.packet.Packet;
import org.springframework.integration.MessageChannel;
import org.springframework.integration.core.MessagingTemplate;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.integration.xmpp.AbstractXmppConnectionAwareEndpoint;
import org.springframework.integration.xmpp.XmppHeaders;
import org.springframework.integration.xmpp.core.AbstractXmppConnectionAwareEndpoint;
import org.springframework.util.Assert;
/**
@@ -38,7 +38,7 @@ import org.springframework.util.Assert;
* @author Oleg Zhurakousky
* @since 2.0
*/
public class XmppMessageDrivenEndpoint extends AbstractXmppConnectionAwareEndpoint {
public class ChatMessageListeningEndpoint extends AbstractXmppConnectionAwareEndpoint {
private final MessagingTemplate messagingTemplate = new MessagingTemplate();
@@ -49,11 +49,11 @@ public class XmppMessageDrivenEndpoint extends AbstractXmppConnectionAwareEndpoi
private volatile PacketListener packetListener;
public XmppMessageDrivenEndpoint(){
public ChatMessageListeningEndpoint(){
super();
}
public XmppMessageDrivenEndpoint(XMPPConnection xmppConnection) {
public ChatMessageListeningEndpoint(XMPPConnection xmppConnection) {
super(xmppConnection);
}

View File

@@ -33,7 +33,7 @@ import org.springframework.integration.MessageHandlingException;
import org.springframework.integration.MessagingException;
import org.springframework.integration.core.MessagingTemplate;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.integration.xmpp.AbstractXmppConnectionAwareEndpoint;
import org.springframework.integration.xmpp.core.AbstractXmppConnectionAwareEndpoint;
import org.springframework.util.Assert;
/**
@@ -45,9 +45,9 @@ import org.springframework.util.Assert;
* @author Oleg Zhurakousky
* @since 2.0
*/
public class XmppRosterListeningEndpoint extends AbstractXmppConnectionAwareEndpoint {
public class RosterListeningEndpoint extends AbstractXmppConnectionAwareEndpoint {
private static final Log logger = LogFactory.getLog(XmppRosterListeningEndpoint.class);
private static final Log logger = LogFactory.getLog(RosterListeningEndpoint.class);
private volatile MessageChannel requestChannel;
@@ -56,11 +56,11 @@ public class XmppRosterListeningEndpoint extends AbstractXmppConnectionAwareEndp
private final EventForwardingRosterListener rosterListener = new EventForwardingRosterListener();
public XmppRosterListeningEndpoint() {
public RosterListeningEndpoint() {
super();
}
public XmppRosterListeningEndpoint(XMPPConnection xmppConnection) {
public RosterListeningEndpoint(XMPPConnection xmppConnection) {
super(xmppConnection);
}

View File

@@ -20,8 +20,8 @@ import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.springframework.integration.Message;
import org.springframework.integration.MessageHandlingException;
import org.springframework.integration.xmpp.AbstractXmppConnectionAwareMessageHandler;
import org.springframework.integration.xmpp.XmppHeaders;
import org.springframework.integration.xmpp.core.AbstractXmppConnectionAwareMessageHandler;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
@@ -31,13 +31,13 @@ import org.springframework.util.StringUtils;
* @author Oleg Zhurakousky
* @since 2.0
*/
public class XmppMessageSendingMessageHandler extends AbstractXmppConnectionAwareMessageHandler {
public class ChatMessageSendingMessageHandler extends AbstractXmppConnectionAwareMessageHandler {
public XmppMessageSendingMessageHandler(){
public ChatMessageSendingMessageHandler(){
super();
}
public XmppMessageSendingMessageHandler(XMPPConnection xmppConnection){
public ChatMessageSendingMessageHandler(XMPPConnection xmppConnection){
super(xmppConnection);
}

View File

@@ -19,7 +19,7 @@ package org.springframework.integration.xmpp.outbound;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.packet.Presence;
import org.springframework.integration.Message;
import org.springframework.integration.xmpp.AbstractXmppConnectionAwareMessageHandler;
import org.springframework.integration.xmpp.core.AbstractXmppConnectionAwareMessageHandler;
import org.springframework.util.Assert;
/**
@@ -29,13 +29,13 @@ import org.springframework.util.Assert;
* @author Oleg Zhurakousky
* @since 2.0
*/
public class XmppPresenceSendingMessageHandler extends AbstractXmppConnectionAwareMessageHandler {
public class PresenceSendingMessageHandler extends AbstractXmppConnectionAwareMessageHandler {
public XmppPresenceSendingMessageHandler() {
public PresenceSendingMessageHandler() {
super();
}
public XmppPresenceSendingMessageHandler(XMPPConnection xmppConnection) {
public PresenceSendingMessageHandler(XMPPConnection xmppConnection) {
super(xmppConnection);
}

View File

@@ -46,6 +46,69 @@
</xsd:complexType>
</xsd:element>
<xsd:element name="inbound-channel-adapter">
<xsd:annotation>
<xsd:documentation>
Configures an endpoint that will receive chat messages sent to a given account and then forward those messages to a MessageChannel.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:attribute name="id" type="xsd:string"/>
<xsd:attribute name="extract-payload" type="xsd:string" default="true"/>
<xsd:attribute name="auto-startup" type="xsd:string" default="true"/>
<xsd:attribute name="channel" use="required" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.core.MessageChannel"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="xmpp-connection" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.jivesoftware.smack.XMPPConnection"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="outbound-channel-adapter">
<xsd:annotation>
<xsd:documentation>
Outbound Channel Adapter that sends chat messages.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="integration:poller" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
<xsd:attribute name="id" type="xsd:string"/>
<xsd:attribute name="channel" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.core.MessageChannel"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="xmpp-connection" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.jivesoftware.smack.XMPPConnection"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="presence-outbound-channel-adapter">
<xsd:annotation>
<xsd:documentation>
@@ -78,10 +141,10 @@
</xsd:complexType>
</xsd:element>
<xsd:element name="roster-event-inbound-channel-adapter">
<xsd:element name="presence-inbound-channel-adapter">
<xsd:annotation>
<xsd:documentation>
Configures an endpoint that will forward roster based events (entry managment and presence state changes) to components in the bus.
Configures an endpoint that will forward Presence state changes to a MessageChannel.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
@@ -109,69 +172,6 @@
</xsd:complexType>
</xsd:element>
<xsd:element name="message-inbound-channel-adapter">
<xsd:annotation>
<xsd:documentation>
Configures an endpoint that will receive messages sent to a given account and then forward those messages to components in the bus.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:attribute name="id" type="xsd:string"/>
<xsd:attribute name="extract-payload" type="xsd:string" default="true"/>
<xsd:attribute name="auto-startup" type="xsd:string" default="true"/>
<xsd:attribute name="channel" use="required" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.core.MessageChannel"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="xmpp-connection" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.jivesoftware.smack.XMPPConnection"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="message-outbound-channel-adapter">
<xsd:annotation>
<xsd:documentation>
Component that sends messages to an entry in the roster on behalf of components in the bus.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="integration:poller" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
<xsd:attribute name="id" type="xsd:string"/>
<xsd:attribute name="channel" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.core.MessageChannel"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="xmpp-connection" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.jivesoftware.smack.XMPPConnection"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="header-enricher">
<xsd:complexType>
<xsd:annotation>

View File

@@ -24,8 +24,8 @@
<channel id="xmppInbound"/>
<xmpp:message-inbound-channel-adapter id="xmppInboundAdapter" channel="xmppInbound"
xmpp-connection="testConnection" extract-payload="false" auto-startup="false"/>
<xmpp:inbound-channel-adapter id="xmppInboundAdapter" channel="xmppInbound"
xmpp-connection="testConnection" extract-payload="false" auto-startup="false"/>

View File

@@ -24,7 +24,7 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.integration.xmpp.inbound.XmppMessageDrivenEndpoint;
import org.springframework.integration.xmpp.inbound.ChatMessageListeningEndpoint;
/**
* @author Oleg Zhurakousky
@@ -36,7 +36,7 @@ public class InboundXmppEndpointParserTests {
public void testInboundAdapter(){
ApplicationContext context =
new ClassPathXmlApplicationContext("InboundXmppEndpointParserTests-context.xml", this.getClass());
XmppMessageDrivenEndpoint xmde = context.getBean("xmppInboundAdapter", XmppMessageDrivenEndpoint.class);
ChatMessageListeningEndpoint xmde = context.getBean("xmppInboundAdapter", ChatMessageListeningEndpoint.class);
assertFalse(xmde.isAutoStartup());
DirectChannel channel = (DirectChannel) TestUtils.getPropertyValue(xmde, "requestChannel");
assertEquals("xmppInbound", channel.getComponentName());

View File

@@ -17,7 +17,7 @@
<int:channel id="outboundEventChannel"/>
<int-xmpp:message-outbound-channel-adapter id="outboundEventAdapter"
channel="outboundEventChannel"
xmpp-connection="xmppConnection"/>
<int-xmpp:outbound-channel-adapter id="outboundEventAdapter"
channel="outboundEventChannel"
xmpp-connection="xmppConnection"/>
</beans>

View File

@@ -13,23 +13,23 @@
<int:channel id="outboundEventChannel"/>
<int-xmpp:message-outbound-channel-adapter id="outboundEventAdapter"
channel="outboundEventChannel"
xmpp-connection="testConnection"/>
<int-xmpp:outbound-channel-adapter id="outboundEventAdapter"
channel="outboundEventChannel"
xmpp-connection="testConnection"/>
<int:channel id="outboundPollingChannel">
<int:queue/>
</int:channel>
<int-xmpp:message-outbound-channel-adapter id="outboundPollingAdapter"
channel="outboundPollingChannel"
xmpp-connection="testConnection">
<int-xmpp:outbound-channel-adapter id="outboundPollingAdapter"
channel="outboundPollingChannel"
xmpp-connection="testConnection">
<int:poller fixed-rate="1000" max-messages-per-poll="1"/>
</int-xmpp:message-outbound-channel-adapter>
</int-xmpp:outbound-channel-adapter>
<int-xmpp:message-outbound-channel-adapter id="outboundNoChannelAdapter"
<int-xmpp:outbound-channel-adapter id="outboundNoChannelAdapter"
xmpp-connection="testConnection">
<!-- <int:poller fixed-rate="1000" max-messages-per-poll="1"/>-->
</int-xmpp:message-outbound-channel-adapter>
</int-xmpp:outbound-channel-adapter>
</beans>

View File

@@ -11,7 +11,7 @@
<constructor-arg value="org.jivesoftware.smack.XMPPConnection"/>
</bean>
<int-xmpp:roster-event-inbound-channel-adapter channel="outChannel"
<int-xmpp:presence-inbound-channel-adapter channel="outChannel"
xmpp-connection="testConnection" auto-startup="false"/>
<int:channel id="outChannel"/>

View File

@@ -20,12 +20,12 @@ import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.integration.xmpp.outbound.XmppPresenceSendingMessageHandler;
import org.springframework.integration.xmpp.outbound.PresenceSendingMessageHandler;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* Tests {@link XmppPresenceSendingMessageHandler} to ensure that we are able to publish status.
* Tests {@link PresenceSendingMessageHandler} to ensure that we are able to publish status.
*
* @author Josh Long
* @since 2.0

View File

@@ -32,8 +32,8 @@ import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.integration.xmpp.XmppContextUtils;
import org.springframework.integration.xmpp.inbound.XmppMessageDrivenEndpoint;
import org.springframework.integration.xmpp.core.XmppContextUtils;
import org.springframework.integration.xmpp.inbound.ChatMessageListeningEndpoint;
/**
* @author Oleg Zhurakousky
@@ -49,7 +49,7 @@ public class XmppMessageDrivenEndpointTests {
public void testLifecycle(){
final Set<PacketListener> packetListSet = new HashSet<PacketListener>();
XMPPConnection connection = mock(XMPPConnection.class);
XmppMessageDrivenEndpoint endpoint = new XmppMessageDrivenEndpoint(connection);
ChatMessageListeningEndpoint endpoint = new ChatMessageListeningEndpoint(connection);
doAnswer(new Answer<Object>() {
public Object answer(InvocationOnMock invocation) throws Throwable {
@@ -75,7 +75,7 @@ public class XmppMessageDrivenEndpointTests {
@Test(expected=IllegalArgumentException.class)
public void testNonInitializationFailure(){
XmppMessageDrivenEndpoint endpoint = new XmppMessageDrivenEndpoint(mock(XMPPConnection.class));
ChatMessageListeningEndpoint endpoint = new ChatMessageListeningEndpoint(mock(XMPPConnection.class));
endpoint.start();
}
@@ -83,7 +83,7 @@ public class XmppMessageDrivenEndpointTests {
public void testWithImplicitXmppConnection(){
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
bf.registerSingleton(XmppContextUtils.XMPP_CONNECTION_BEAN_NAME, mock(XMPPConnection.class));
XmppMessageDrivenEndpoint endpoint = new XmppMessageDrivenEndpoint();
ChatMessageListeningEndpoint endpoint = new ChatMessageListeningEndpoint();
endpoint.setBeanFactory(bf);
endpoint.afterPropertiesSet();
assertNotNull(TestUtils.getPropertyValue(endpoint,"xmppConnection"));
@@ -91,7 +91,7 @@ public class XmppMessageDrivenEndpointTests {
@Test(expected=IllegalArgumentException.class)
public void testNoXmppConnection(){
XmppMessageDrivenEndpoint endpoint = new XmppMessageDrivenEndpoint();
ChatMessageListeningEndpoint endpoint = new ChatMessageListeningEndpoint();
endpoint.afterPropertiesSet();
}
}

View File

@@ -40,8 +40,8 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.integration.Message;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.integration.xmpp.XmppContextUtils;
import org.springframework.integration.xmpp.inbound.XmppRosterListeningEndpoint;
import org.springframework.integration.xmpp.core.XmppContextUtils;
import org.springframework.integration.xmpp.inbound.RosterListeningEndpoint;
/**
* @author Oleg Zhurakousky
@@ -69,7 +69,7 @@ public class XmppRosterListeningEndpointTests {
return null;
}
}).when(roster).removeRosterListener(Mockito.any(RosterListener.class));
XmppRosterListeningEndpoint rosterEndpoint = new XmppRosterListeningEndpoint(connection);
RosterListeningEndpoint rosterEndpoint = new RosterListeningEndpoint(connection);
rosterEndpoint.afterPropertiesSet();
assertEquals(0, rosterSet.size());
rosterEndpoint.start();
@@ -80,7 +80,7 @@ public class XmppRosterListeningEndpointTests {
@Test(expected=IllegalArgumentException.class)
public void testNonInitializedFailure(){
XmppRosterListeningEndpoint rosterEndpoint = new XmppRosterListeningEndpoint(mock(XMPPConnection.class));
RosterListeningEndpoint rosterEndpoint = new RosterListeningEndpoint(mock(XMPPConnection.class));
rosterEndpoint.start();
}
@@ -89,7 +89,7 @@ public class XmppRosterListeningEndpointTests {
XMPPConnection connection = mock(XMPPConnection.class);
Roster roster = mock(Roster.class);
when(connection.getRoster()).thenReturn(roster);
XmppRosterListeningEndpoint rosterEndpoint = new XmppRosterListeningEndpoint(connection);
RosterListeningEndpoint rosterEndpoint = new RosterListeningEndpoint(connection);
QueueChannel channel = new QueueChannel();
rosterEndpoint.setRequestChannel(channel);
rosterEndpoint.afterPropertiesSet();
@@ -106,7 +106,7 @@ public class XmppRosterListeningEndpointTests {
XMPPConnection connection = mock(XMPPConnection.class);
Roster roster = mock(Roster.class);
when(connection.getRoster()).thenReturn(roster);
XmppRosterListeningEndpoint rosterEndpoint = new XmppRosterListeningEndpoint(connection);
RosterListeningEndpoint rosterEndpoint = new RosterListeningEndpoint(connection);
QueueChannel channel = new QueueChannel();
rosterEndpoint.setRequestChannel(channel);
rosterEndpoint.afterPropertiesSet();
@@ -122,7 +122,7 @@ public class XmppRosterListeningEndpointTests {
public void testWithImplicitXmppConnection(){
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
bf.registerSingleton(XmppContextUtils.XMPP_CONNECTION_BEAN_NAME, mock(XMPPConnection.class));
XmppRosterListeningEndpoint endpoint = new XmppRosterListeningEndpoint();
RosterListeningEndpoint endpoint = new RosterListeningEndpoint();
endpoint.setBeanFactory(bf);
endpoint.afterPropertiesSet();
assertNotNull(TestUtils.getPropertyValue(endpoint,"xmppConnection"));
@@ -130,7 +130,7 @@ public class XmppRosterListeningEndpointTests {
@Test(expected=IllegalArgumentException.class)
public void testNoXmppConnection(){
XmppRosterListeningEndpoint handler = new XmppRosterListeningEndpoint();
RosterListeningEndpoint handler = new RosterListeningEndpoint();
handler.afterPropertiesSet();
}
}

View File

@@ -22,9 +22,9 @@ import org.springframework.integration.MessageHandlingException;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.integration.xmpp.XmppContextUtils;
import org.springframework.integration.xmpp.XmppHeaders;
import org.springframework.integration.xmpp.outbound.XmppMessageSendingMessageHandler;
import org.springframework.integration.xmpp.core.XmppContextUtils;
import org.springframework.integration.xmpp.outbound.ChatMessageSendingMessageHandler;
/**
* @author Oleg Zhurakousky
@@ -41,7 +41,7 @@ public class XmppMessageSendingMessageHandlerTests {
Chat chat = mock(Chat.class);
when(chantManager.createChat(Mockito.any(String.class), Mockito.any(MessageListener.class))).thenReturn(chat);
XmppMessageSendingMessageHandler handler = new XmppMessageSendingMessageHandler(connection);
ChatMessageSendingMessageHandler handler = new ChatMessageSendingMessageHandler(connection);
handler.afterPropertiesSet();
Message<?> message = MessageBuilder.withPayload("Test Message").
setHeader(XmppHeaders.CHAT_TO_USER, "kermit@frog.com").
@@ -69,20 +69,20 @@ public class XmppMessageSendingMessageHandlerTests {
@Test(expected=MessageHandlingException.class)
public void validateFailureNoChatToUser() throws Exception{
XmppMessageSendingMessageHandler handler = new XmppMessageSendingMessageHandler(mock(XMPPConnection.class));
ChatMessageSendingMessageHandler handler = new ChatMessageSendingMessageHandler(mock(XMPPConnection.class));
handler.handleMessage(new GenericMessage<String>("hello"));
}
@Test(expected=MessageHandlingException.class)
public void validateMessageWithUnsupportedPayload() throws Exception{
XmppMessageSendingMessageHandler handler = new XmppMessageSendingMessageHandler(mock(XMPPConnection.class));
ChatMessageSendingMessageHandler handler = new ChatMessageSendingMessageHandler(mock(XMPPConnection.class));
handler.handleMessage(new GenericMessage<Integer>(123));
}
@Test
public void testWithImplicitXmppConnection(){
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
bf.registerSingleton(XmppContextUtils.XMPP_CONNECTION_BEAN_NAME, mock(XMPPConnection.class));
XmppMessageSendingMessageHandler handler = new XmppMessageSendingMessageHandler();
ChatMessageSendingMessageHandler handler = new ChatMessageSendingMessageHandler();
handler.setBeanFactory(bf);
handler.afterPropertiesSet();
assertNotNull(TestUtils.getPropertyValue(handler,"xmppConnection"));
@@ -90,7 +90,7 @@ public class XmppMessageSendingMessageHandlerTests {
@Test(expected=IllegalArgumentException.class)
public void testNoXmppConnection(){
XmppMessageSendingMessageHandler handler = new XmppMessageSendingMessageHandler();
ChatMessageSendingMessageHandler handler = new ChatMessageSendingMessageHandler();
handler.afterPropertiesSet();
}
}

View File

@@ -25,8 +25,8 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.integration.MessageHandlingException;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.integration.xmpp.XmppContextUtils;
import org.springframework.integration.xmpp.outbound.XmppPresenceSendingMessageHandler;
import org.springframework.integration.xmpp.core.XmppContextUtils;
import org.springframework.integration.xmpp.outbound.PresenceSendingMessageHandler;
/**
* @author Oleg Zhurakousky
@@ -37,7 +37,7 @@ public class XmppRosterEventMessageSendingHandlerTests {
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void testPresencePayload(){
XmppPresenceSendingMessageHandler handler = new XmppPresenceSendingMessageHandler(mock(XMPPConnection.class));
PresenceSendingMessageHandler handler = new PresenceSendingMessageHandler(mock(XMPPConnection.class));
handler.afterPropertiesSet();
handler.handleMessage(new GenericMessage(mock(Presence.class)));
}
@@ -45,7 +45,7 @@ public class XmppRosterEventMessageSendingHandlerTests {
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test(expected=MessageHandlingException.class)
public void testWrongPayload(){
XmppPresenceSendingMessageHandler handler = new XmppPresenceSendingMessageHandler(mock(XMPPConnection.class));
PresenceSendingMessageHandler handler = new PresenceSendingMessageHandler(mock(XMPPConnection.class));
handler.afterPropertiesSet();
handler.handleMessage(new GenericMessage(new Object()));
}
@@ -54,7 +54,7 @@ public class XmppRosterEventMessageSendingHandlerTests {
public void testWithImplicitXmppConnection(){
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
bf.registerSingleton(XmppContextUtils.XMPP_CONNECTION_BEAN_NAME, mock(XMPPConnection.class));
XmppPresenceSendingMessageHandler handler = new XmppPresenceSendingMessageHandler();
PresenceSendingMessageHandler handler = new PresenceSendingMessageHandler();
handler.setBeanFactory(bf);
handler.afterPropertiesSet();
assertNotNull(TestUtils.getPropertyValue(handler,"xmppConnection"));
@@ -62,7 +62,7 @@ public class XmppRosterEventMessageSendingHandlerTests {
@Test(expected=IllegalArgumentException.class)
public void testNoXmppConnection(){
XmppPresenceSendingMessageHandler handler = new XmppPresenceSendingMessageHandler();
PresenceSendingMessageHandler handler = new PresenceSendingMessageHandler();
handler.afterPropertiesSet();
}
}