diff --git a/helloworld/src/main/java/org/springframework/amqp/helloworld/async/ConsumerConfiguration.java b/helloworld/src/main/java/org/springframework/amqp/helloworld/async/ConsumerConfiguration.java
index 681440f..9c6a283 100644
--- a/helloworld/src/main/java/org/springframework/amqp/helloworld/async/ConsumerConfiguration.java
+++ b/helloworld/src/main/java/org/springframework/amqp/helloworld/async/ConsumerConfiguration.java
@@ -13,7 +13,7 @@ public class ConsumerConfiguration extends HelloWorldConfiguration {
public SimpleMessageListenerContainer listenerContainer() {
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
container.setConnectionFactory(connectionFactory());
- container.setQueueName(this.helloWorldQueueName);
+ container.setQueueNames(this.helloWorldQueueName);
container.setMessageListener(new MessageListenerAdapter(new HelloWorldHandler()));
return container;
}
diff --git a/stocks/src/main/resources/log4j.properties b/stocks/src/main/resources/log4j.properties
index 9022c83..1343d41 100644
--- a/stocks/src/main/resources/log4j.properties
+++ b/stocks/src/main/resources/log4j.properties
@@ -4,8 +4,8 @@ log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
#log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n
-log4j.appender.stdout.layout.ConversionPattern=%-5p [%40.40c{4}]: %m%n
+log4j.appender.stdout.layout.ConversionPattern=%-5p %8t [%40.40c{4}]: %m%n
-#log4j.category.org.springframework.amqp.rabbit=DEBUG
+log4j.category.org.springframework.amqp.rabbit=DEBUG
log4j.category.org.springframework.beans.factory=INFO
diff --git a/stocks/src/main/resources/servlet-config.xml b/stocks/src/main/resources/servlet-config.xml
index 78c6a80..bea9264 100644
--- a/stocks/src/main/resources/servlet-config.xml
+++ b/stocks/src/main/resources/servlet-config.xml
@@ -18,31 +18,31 @@
-
+
-
+
+
+
-
-
+
+
-
-
-
+
diff --git a/stocks/src/test/java/org/springframework/amqp/rabbit/stocks/Client.java b/stocks/src/test/java/org/springframework/amqp/rabbit/stocks/Client.java
index fde50d8..a9b8df7 100644
--- a/stocks/src/test/java/org/springframework/amqp/rabbit/stocks/Client.java
+++ b/stocks/src/test/java/org/springframework/amqp/rabbit/stocks/Client.java
@@ -1,23 +1,21 @@
/*
* 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.
+ *
+ * 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.amqp.rabbit.stocks;
import javax.swing.JFrame;
+import org.junit.After;
import org.junit.Test;
import org.springframework.amqp.rabbit.stocks.ui.StockController;
@@ -32,20 +30,29 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
*/
public class Client {
+ private ConfigurableApplicationContext context;
+
public static void main(String[] args) {
new Client().run();
}
@Test
public void run() {
- ConfigurableApplicationContext context = new ClassPathXmlApplicationContext("client-bootstrap-config.xml");
+ context = new ClassPathXmlApplicationContext("client-bootstrap-config.xml");
StockController controller = context.getBean(StockController.class);
JFrame f = new JFrame("Rabbit Stock Demo");
- f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- //TODO consider @Configurable
- f.add(new StockPanel(controller));
- f.pack();
- f.setVisible(true);
+ f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ // TODO consider @Configurable
+ f.add(new StockPanel(controller));
+ f.pack();
+ f.setVisible(true);
+ }
+
+ @After
+ public void close() {
+ if (context != null) {
+ context.close();
+ }
}
}
diff --git a/stocks/src/test/java/org/springframework/amqp/rabbit/stocks/Server.java b/stocks/src/test/java/org/springframework/amqp/rabbit/stocks/Server.java
index 3c55c9c..90860fa 100644
--- a/stocks/src/test/java/org/springframework/amqp/rabbit/stocks/Server.java
+++ b/stocks/src/test/java/org/springframework/amqp/rabbit/stocks/Server.java
@@ -16,6 +16,7 @@
package org.springframework.amqp.rabbit.stocks;
+import org.junit.After;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@@ -27,13 +28,22 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
*/
public class Server {
+ private ClassPathXmlApplicationContext context;
+
public static void main(String[] args) {
new Server().run();
}
+ @After
+ public void close() {
+ if (context != null) {
+ context.close();
+ }
+ }
+
@Test
public void run() {
- new ClassPathXmlApplicationContext("server-bootstrap-config.xml");
+ context = new ClassPathXmlApplicationContext("server-bootstrap-config.xml");
}
}
diff --git a/stocks/src/test/java/org/springframework/amqp/rabbit/stocks/web/ServletConfigurationTests.java b/stocks/src/test/java/org/springframework/amqp/rabbit/stocks/web/ServletConfigurationTests.java
index 27f9b2d..02a8953 100644
--- a/stocks/src/test/java/org/springframework/amqp/rabbit/stocks/web/ServletConfigurationTests.java
+++ b/stocks/src/test/java/org/springframework/amqp/rabbit/stocks/web/ServletConfigurationTests.java
@@ -23,12 +23,21 @@ public class ServletConfigurationTests {
@Test
public void testContext() throws Exception {
+
ClassPathXmlApplicationContext parent = new ClassPathXmlApplicationContext(
"classpath:/server-bootstrap-config.xml");
- ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
- new String[] { "classpath:/servlet-config.xml" }, parent);
- context.close();
- parent.close();
+
+ try {
+
+ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
+ new String[] { "classpath:/servlet-config.xml" }, parent);
+ context.close();
+
+ } finally {
+
+ parent.close();
+
+ }
}
}