You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by de...@apache.org on 2010/03/31 14:09:21 UTC
svn commit: r929491 - in
/activemq/activemq-systest/trunk/src/test/java/org/apache/activemq/systest/camel:
./ AMQ2677.java TestMDB.java
Author: dejanb
Date: Wed Mar 31 12:09:20 2010
New Revision: 929491
URL: http://svn.apache.org/viewvc?rev=929491&view=rev
Log:
fixing package names
Added:
activemq/activemq-systest/trunk/src/test/java/org/apache/activemq/systest/camel/
activemq/activemq-systest/trunk/src/test/java/org/apache/activemq/systest/camel/AMQ2677.java
activemq/activemq-systest/trunk/src/test/java/org/apache/activemq/systest/camel/TestMDB.java
Added: activemq/activemq-systest/trunk/src/test/java/org/apache/activemq/systest/camel/AMQ2677.java
URL: http://svn.apache.org/viewvc/activemq/activemq-systest/trunk/src/test/java/org/apache/activemq/systest/camel/AMQ2677.java?rev=929491&view=auto
==============================================================================
--- activemq/activemq-systest/trunk/src/test/java/org/apache/activemq/systest/camel/AMQ2677.java (added)
+++ activemq/activemq-systest/trunk/src/test/java/org/apache/activemq/systest/camel/AMQ2677.java Wed Mar 31 12:09:20 2010
@@ -0,0 +1,82 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.activemq.systest.camel;
+
+import javax.jms.Connection;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+
+import junit.framework.TestCase;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.command.ActiveMQQueue;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class AMQ2677 extends TestCase {
+
+ private static final Log log = LogFactory.getLog(AMQ2677.class);
+
+ private static ClassPathXmlApplicationContext context;
+
+ public void testPooledConnections() throws Exception {
+ new Thread(new Runnable() {
+ public void run() {
+ context = new ClassPathXmlApplicationContext("jmstest-camel.xml");
+ }
+ }, "TestThread").start();
+
+ log.info("main sleeping 10 seconds");
+ Thread.sleep(10000);
+
+ log.info("main starting broker");
+ final BrokerService brokerService = new BrokerService();
+ brokerService.setPersistent(false);
+ brokerService.addConnector("tcp://127.0.0.1:61616");
+ brokerService.start();
+
+ log.info("main finished starting broker, sleeping 10 seconds");
+ Thread.sleep(10000);
+
+ try {
+ final Connection connection = new ActiveMQConnectionFactory(
+ "tcp://127.0.0.1:61616").createConnection();
+ final Session session = connection.createSession(false,
+ Session.AUTO_ACKNOWLEDGE);
+ final MessageProducer producer = session
+ .createProducer(new ActiveMQQueue("test.queue"));
+ connection.start();
+ for (int i = 0; i < 10; ++i) {
+ log.info("main sending " + i);
+ producer.send(session.createTextMessage(Integer.toString(i)));
+ }
+ } catch (Exception e) {
+ log.warn("main", e);
+ }
+
+ Thread.sleep(2000);
+
+ assertEquals("Messages not received", 10, ((TestMDB)context.getBean("testMDB")).getReceived());
+
+ brokerService.stop();
+ context.stop();
+ context.close();
+ }
+
+}
Added: activemq/activemq-systest/trunk/src/test/java/org/apache/activemq/systest/camel/TestMDB.java
URL: http://svn.apache.org/viewvc/activemq/activemq-systest/trunk/src/test/java/org/apache/activemq/systest/camel/TestMDB.java?rev=929491&view=auto
==============================================================================
--- activemq/activemq-systest/trunk/src/test/java/org/apache/activemq/systest/camel/TestMDB.java (added)
+++ activemq/activemq-systest/trunk/src/test/java/org/apache/activemq/systest/camel/TestMDB.java Wed Mar 31 12:09:20 2010
@@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.activemq.systest.camel;
+
+import org.apache.camel.Body;
+import org.apache.camel.Consume;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class TestMDB {
+
+ private final Log log = LogFactory.getLog(getClass());
+ int received = 0;
+
+ public void init() {
+ log.info("init");
+ }
+
+ public void destroy() {
+ log.info("destroy");
+ }
+
+ @Consume(ref = "testQueueEndpoint")
+ public void processMessage(@Body String message) {
+ log.info("processMessage message = " + message);
+ received++;
+ }
+
+ public int getReceived() {
+ return received;
+ }
+
+}