From 862d27bb3d45e4eab930b77f155e7aedf58def0e Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Mon, 5 Jul 2010 21:29:04 +0000 Subject: [PATCH] INT-1222 added @Ignore to all integration tests that depend on an XMPP server, etc. --- .../config/XmppHeaderEnricherParserTests.java | 1 + .../xmpp/messages/ConsoleChatTests.java | 3 +- .../messages/InboundXmppEndpointTests.java | 3 +- .../messages/OutboundXmppEndpointTests.java | 3 +- .../InboundXmppRosterEventsEndpointTests.java | 19 ++++++- ...OutboundXmppRosterEventsEndpointTests.java | 20 +++++++- .../presence/PresenceMessageComboTests.java | 19 ++++++- .../presence/XmppRosterEventConsumer.java | 42 ++++++++++----- .../presence/XmppRosterEventProducer.java | 51 +++++++++++++------ 9 files changed, 127 insertions(+), 34 deletions(-) diff --git a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/XmppHeaderEnricherParserTests.java b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/XmppHeaderEnricherParserTests.java index 1e44d90e04..de3884b337 100644 --- a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/XmppHeaderEnricherParserTests.java +++ b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/config/XmppHeaderEnricherParserTests.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.integration.xmpp.config; import org.junit.Test; diff --git a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/messages/ConsoleChatTests.java b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/messages/ConsoleChatTests.java index ca8482af56..e8acd276d4 100644 --- a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/messages/ConsoleChatTests.java +++ b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/messages/ConsoleChatTests.java @@ -16,6 +16,7 @@ package org.springframework.integration.xmpp.messages; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; @@ -29,7 +30,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) public class ConsoleChatTests { - @Test + @Test @Ignore public void run() throws Exception { Thread.sleep( 10 * 1000 ); } diff --git a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/messages/InboundXmppEndpointTests.java b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/messages/InboundXmppEndpointTests.java index 4f7b5b241f..867a0fa9b6 100644 --- a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/messages/InboundXmppEndpointTests.java +++ b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/messages/InboundXmppEndpointTests.java @@ -16,6 +16,7 @@ package org.springframework.integration.xmpp.messages; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; @@ -29,7 +30,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) public class InboundXmppEndpointTests { - @Test + @Test @Ignore public void run() throws Exception { Thread.sleep( 10 * 1000 ); } diff --git a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/messages/OutboundXmppEndpointTests.java b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/messages/OutboundXmppEndpointTests.java index 0d846f1148..6bde271c88 100644 --- a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/messages/OutboundXmppEndpointTests.java +++ b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/messages/OutboundXmppEndpointTests.java @@ -16,6 +16,7 @@ package org.springframework.integration.xmpp.messages; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; @@ -32,7 +33,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) public class OutboundXmppEndpointTests { - @Test + @Test @Ignore public void run() throws Exception { Thread.sleep(10 * 1000); } diff --git a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/presence/InboundXmppRosterEventsEndpointTests.java b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/presence/InboundXmppRosterEventsEndpointTests.java index 51f741a25b..18a27bd2e1 100644 --- a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/presence/InboundXmppRosterEventsEndpointTests.java +++ b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/presence/InboundXmppRosterEventsEndpointTests.java @@ -1,5 +1,22 @@ +/* + * Copyright 2002-2010 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. + * 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.springframework.integration.xmpp.presence; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; @@ -16,7 +33,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) public class InboundXmppRosterEventsEndpointTests { - @Test + @Test @Ignore public void run() throws Exception { Thread.sleep( 60 * 1000); } diff --git a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/presence/OutboundXmppRosterEventsEndpointTests.java b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/presence/OutboundXmppRosterEventsEndpointTests.java index 4b42f0e8d6..4c8c818e09 100644 --- a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/presence/OutboundXmppRosterEventsEndpointTests.java +++ b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/presence/OutboundXmppRosterEventsEndpointTests.java @@ -1,5 +1,22 @@ +/* + * Copyright 2002-2010 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. + * 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.springframework.integration.xmpp.presence; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; @@ -16,7 +33,8 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @ContextConfiguration @RunWith(SpringJUnit4ClassRunner.class) public class OutboundXmppRosterEventsEndpointTests { - @Test + + @Test @Ignore public void testOutbound() throws Throwable { Thread.sleep( 60 * 1000); } diff --git a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/presence/PresenceMessageComboTests.java b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/presence/PresenceMessageComboTests.java index 46f3a5d6e9..955e969d38 100644 --- a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/presence/PresenceMessageComboTests.java +++ b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/presence/PresenceMessageComboTests.java @@ -1,5 +1,22 @@ +/* + * Copyright 2002-2010 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. + * 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.springframework.integration.xmpp.presence; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; @@ -20,7 +37,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) public class PresenceMessageComboTests { - @Test + @Test @Ignore public void run () throws Throwable { Thread.sleep( 60 * 1000); } diff --git a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/presence/XmppRosterEventConsumer.java b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/presence/XmppRosterEventConsumer.java index 96fd1b52db..c34f3e19c8 100644 --- a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/presence/XmppRosterEventConsumer.java +++ b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/presence/XmppRosterEventConsumer.java @@ -1,3 +1,19 @@ +/* + * Copyright 2002-2010 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. + * 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.springframework.integration.xmpp.presence; import org.apache.commons.lang.StringUtils; @@ -6,24 +22,24 @@ import org.springframework.integration.core.Message; import org.springframework.integration.core.MessageHeaders; import org.springframework.integration.xmpp.XmppHeaders; -import java.util.Collection; - /** - * - * This class reacts to changes in {@link org.jivesoftware.smack.packet.Presence} objects for a given account. - * + * This class reacts to changes in + * {@link org.jivesoftware.smack.packet.Presence} objects for a given account. + * * @author Josh Long * @since 2.0 */ public class XmppRosterEventConsumer { - @ServiceActivator - public void presenceChanged ( Message presenceEventMsg ) throws Exception { - System.out.println(StringUtils.repeat( "-" , 100)); - String whosePresence = (String)presenceEventMsg.getHeaders().get( XmppHeaders.PRESENCE_FROM); - System.out.println( "entries affected: " + whosePresence); - MessageHeaders messageHeaders = presenceEventMsg.getHeaders(); - for( String h : messageHeaders.keySet() ) - System.out.println( String.format( "%s = %s", h, messageHeaders.get(h))); + @ServiceActivator + public void presenceChanged(Message presenceEventMsg) throws Exception { + System.out.println(StringUtils.repeat("-", 100)); + String whosePresence = (String) presenceEventMsg.getHeaders().get(XmppHeaders.PRESENCE_FROM); + System.out.println("entries affected: " + whosePresence); + MessageHeaders messageHeaders = presenceEventMsg.getHeaders(); + for (String h : messageHeaders.keySet()) { + System.out.println(String.format("%s = %s", h, messageHeaders.get(h))); + } } + } diff --git a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/presence/XmppRosterEventProducer.java b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/presence/XmppRosterEventProducer.java index e398546ba5..17e2123865 100644 --- a/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/presence/XmppRosterEventProducer.java +++ b/spring-integration-xmpp/src/test/java/org/springframework/integration/xmpp/presence/XmppRosterEventProducer.java @@ -1,3 +1,19 @@ +/* + * Copyright 2002-2010 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. + * 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.springframework.integration.xmpp.presence; import org.apache.commons.lang.StringUtils; @@ -8,24 +24,29 @@ import org.springframework.integration.core.Message; import org.springframework.integration.message.*; import org.springframework.integration.xmpp.XmppHeaders; - /** - * This is used in {@link org.springframework.integration.xmpp.presence.OutboundXmppRosterEventsEndpointTests} to produce fake status / presence updates. - * + * This is used in + * {@link org.springframework.integration.xmpp.presence.OutboundXmppRosterEventsEndpointTests} + * to produce fake status / presence updates. + * * @author Josh Long * @since 2.0 */ public class XmppRosterEventProducer implements MessageSource { - public Message receive() { - try { - Thread.sleep(1000 * 10); - } catch (InterruptedException e) { - // eat it - } - return (Math.random() > .5) ? - MessageBuilder.withPayload(StringUtils.EMPTY).setHeader(XmppHeaders.PRESENCE_MODE, Presence.Mode.chat).setHeader(XmppHeaders.PRESENCE_TYPE, Presence.Type.available) - .setHeader(XmppHeaders.PRESENCE_STATUS, "She Loves me").build() : - MessageBuilder.withPayload(StringUtils.EMPTY).setHeader(XmppHeaders.PRESENCE_MODE, Presence.Mode.dnd).setHeader(XmppHeaders.PRESENCE_TYPE, Presence.Type.available) - .setHeader(XmppHeaders.PRESENCE_STATUS, "She Loves me not").build(); - } + + public Message receive() { + try { + Thread.sleep(1000 * 10); + } + catch (InterruptedException e) { + // eat it + } + return (Math.random() > .5) ? MessageBuilder.withPayload(StringUtils.EMPTY).setHeader( + XmppHeaders.PRESENCE_MODE, Presence.Mode.chat).setHeader(XmppHeaders.PRESENCE_TYPE, + Presence.Type.available).setHeader(XmppHeaders.PRESENCE_STATUS, "She Loves me").build() + : MessageBuilder.withPayload(StringUtils.EMPTY).setHeader(XmppHeaders.PRESENCE_MODE, Presence.Mode.dnd) + .setHeader(XmppHeaders.PRESENCE_TYPE, Presence.Type.available).setHeader( + XmppHeaders.PRESENCE_STATUS, "She Loves me not").build(); + } + }