diff --git a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/CorrelatingMessageBarrierTests.java b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/CorrelatingMessageBarrierTests.java index c6fe00ee8f..c0c98b1924 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/CorrelatingMessageBarrierTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/CorrelatingMessageBarrierTests.java @@ -122,10 +122,10 @@ public class CorrelatingMessageBarrierTests { private final ConcurrentMap keyLocks = new ConcurrentHashMap(); public boolean canRelease(MessageGroup messageGroup) { - System.out.println("Trying to release group: " + messageGroup + "\n to thread: " + Thread.currentThread()); + // System.out.println("Trying to release group: " + messageGroup + "\n to thread: " + Thread.currentThread()); Object correlationKey = messageGroup.getGroupId(); Semaphore lock = lockForKey(correlationKey); - System.out.println(Thread.currentThread() + " got lock: " + lock); + // System.out.println(Thread.currentThread() + " got lock: " + lock); return lock.tryAcquire(); } diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/PriorityChannelTests-context.xml b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/PriorityChannelTests-context.xml new file mode 100644 index 0000000000..5e758822b0 --- /dev/null +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/PriorityChannelTests-context.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/PriorityChannelTests.java b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/PriorityChannelTests.java new file mode 100644 index 0000000000..6823cb7fd9 --- /dev/null +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/PriorityChannelTests.java @@ -0,0 +1,60 @@ +/* + * 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.jmx.config; + +import static org.junit.Assert.assertEquals; + +import java.util.Set; + +import javax.management.MBeanServer; +import javax.management.ObjectName; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * @author Dave Syer + * @since 2.0 + */ +@ContextConfiguration +@RunWith(SpringJUnit4ClassRunner.class) +public class PriorityChannelTests { + + @Autowired + private MBeanServer server; + + @Test + public void testHandlerMBeanRegistration() throws Exception { + Set names = server.queryNames(new ObjectName("test.PriorityChannel:type=MessageHandler,*"), null); + // Error handler plus the service activator + assertEquals(2, names.size()); + } + + @Test + public void testChannelMBeanRegistration() throws Exception { + Set names = server.queryNames(new ObjectName("test.PriorityChannel:type=MessageChannel,name=testChannel,*"), null); + assertEquals(1, names.size()); + assertEquals(0, server.getAttribute(names.iterator().next(), "QueueSize")); + } + + public static class Source { + public String get() { + return "foo"; + } + } + +}