Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 32FAB10A73 for ; Thu, 20 Mar 2014 20:16:03 +0000 (UTC) Received: (qmail 44250 invoked by uid 500); 20 Mar 2014 20:15:47 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 43721 invoked by uid 500); 20 Mar 2014 20:15:34 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 43588 invoked by uid 99); 20 Mar 2014 20:15:32 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Mar 2014 20:15:32 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 8B7CD986CFA; Thu, 20 Mar 2014 20:15:31 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: hadrian@apache.org To: commits@activemq.apache.org Date: Thu, 20 Mar 2014 20:15:43 -0000 Message-Id: <1f82c0754c7a4a049117435564e9c5b5@git.apache.org> In-Reply-To: <6c16abf4302748cda816f03d9fdb2a03@git.apache.org> References: <6c16abf4302748cda816f03d9fdb2a03@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [13/19] git commit: fix and reinstate skipped xa jms/jdbc test that sanity tests xa recovery - remove the load variant that was also skipped fix and reinstate skipped xa jms/jdbc test that sanity tests xa recovery - remove the load variant that was also skipped Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/bb132b13 Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/bb132b13 Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/bb132b13 Branch: refs/heads/activemq-5.9 Commit: bb132b13fa3dd5d7987ec467c985c6543914bb1f Parents: 15bc360 Author: gtully Authored: Wed Mar 5 16:03:14 2014 +0000 Committer: Hadrian Zbarcea Committed: Thu Mar 20 15:17:23 2014 -0400 ---------------------------------------------------------------------- activemq-camel/pom.xml | 7 + .../activemq/camel/JmsJdbcXALoadTest.java | 143 ------------------- .../apache/activemq/camel/JmsJdbcXATest.java | 1 - .../org/apache/activemq/camel/jmsXajdbc.xml | 2 +- 4 files changed, 8 insertions(+), 145 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq/blob/bb132b13/activemq-camel/pom.xml ---------------------------------------------------------------------- diff --git a/activemq-camel/pom.xml b/activemq-camel/pom.xml index e285f78..8b59147 100755 --- a/activemq-camel/pom.xml +++ b/activemq-camel/pom.xml @@ -127,6 +127,13 @@ test + org.apache.openejb + openejb-core + 3.1 + true + test + + org.objectweb.howl howl 1.0.1-1 http://git-wip-us.apache.org/repos/asf/activemq/blob/bb132b13/activemq-camel/src/test/java/org/apache/activemq/camel/JmsJdbcXALoadTest.java ---------------------------------------------------------------------- diff --git a/activemq-camel/src/test/java/org/apache/activemq/camel/JmsJdbcXALoadTest.java b/activemq-camel/src/test/java/org/apache/activemq/camel/JmsJdbcXALoadTest.java deleted file mode 100644 index 00ea6e8..0000000 --- a/activemq-camel/src/test/java/org/apache/activemq/camel/JmsJdbcXALoadTest.java +++ /dev/null @@ -1,143 +0,0 @@ -/** - * 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.camel; - -import java.sql.ResultSet; -import java.sql.SQLException; - -import javax.jms.Connection; -import javax.jms.MessageProducer; -import javax.jms.Session; -import javax.jms.TextMessage; - -import org.apache.activemq.ActiveMQConnectionFactory; -import org.apache.activemq.broker.BrokerService; -import org.apache.activemq.command.ActiveMQQueue; -import org.apache.activemq.util.Wait; -import org.apache.camel.test.spring.CamelSpringTestSupport; -import org.apache.commons.dbcp.BasicDataSource; -import org.junit.Ignore; -import org.junit.Test; -import org.springframework.context.support.AbstractXmlApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -@Ignore("Test hangs") -public class JmsJdbcXALoadTest extends CamelSpringTestSupport { - - BrokerService broker = null; - int messageCount; - - public java.sql.Connection initDb() throws Exception { - String createStatement = "CREATE TABLE SCP_INPUT_MESSAGES (" + "id int NOT NULL GENERATED ALWAYS AS IDENTITY, " + "messageId varchar(96) NOT NULL, " - + "messageCorrelationId varchar(96) NOT NULL, " + "messageContent varchar(2048) NOT NULL, " + "PRIMARY KEY (id) )"; - - java.sql.Connection conn = getJDBCConnection(); - try { - conn.createStatement().execute(createStatement); - } catch (SQLException alreadyExists) { - log.info("ex on create tables", alreadyExists); - } - - try { - conn.createStatement().execute("DELETE FROM SCP_INPUT_MESSAGES"); - } catch (SQLException ex) { - log.info("ex on create delete all", ex); - } - - return conn; - } - - private java.sql.Connection getJDBCConnection() throws Exception { - BasicDataSource dataSource = getMandatoryBean(BasicDataSource.class, "managedDataSourceWithRecovery"); - return dataSource.getConnection(); - } - - private int dumpDb(java.sql.Connection jdbcConn) throws Exception { - int count = 0; - ResultSet resultSet = jdbcConn.createStatement().executeQuery("SELECT * FROM SCP_INPUT_MESSAGES"); - while (resultSet.next()) { - count++; - } - log.info(count + " messages"); - return count; - } - - @SuppressWarnings("unused") - @Test - public void testRecoveryCommit() throws Exception { - java.sql.Connection jdbcConn = initDb(); - final int count = 1000; - - sendJMSMessageToKickOffRoute(count); - - final java.sql.Connection freshConnection = getJDBCConnection(); - assertTrue("did not get replay", Wait.waitFor(new Wait.Condition() { - @Override - public boolean isSatisified() throws Exception { - return count == dumpDb(freshConnection); - } - }, 20 * 60 * 1000)); - assertEquals("still one message in db", count, dumpDb(freshConnection)); - } - - private void sendJMSMessageToKickOffRoute(int count) throws Exception { - ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("vm://testXA"); - factory.setWatchTopicAdvisories(false); - Connection connection = factory.createConnection(); - connection.start(); - Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - MessageProducer producer = session.createProducer(new ActiveMQQueue("scp_transacted")); - for (int i = 0; i < count; i++) { - TextMessage message = session.createTextMessage("Some Text, messageCount:" + messageCount++); - message.setJMSCorrelationID("pleaseCorrelate"); - producer.send(message); - } - connection.close(); - } - - private BrokerService createBroker(boolean deleteAllMessages) throws Exception { - BrokerService brokerService = new BrokerService(); - brokerService.setDeleteAllMessagesOnStartup(deleteAllMessages); - brokerService.setBrokerName("testXA"); - brokerService.setAdvisorySupport(false); - brokerService.setUseJmx(false); - brokerService.setDataDirectory("target/data"); - brokerService.addConnector("tcp://0.0.0.0:61616"); - return brokerService; - } - - @Override - protected AbstractXmlApplicationContext createApplicationContext() { - - deleteDirectory("target/data/howl"); - - // make broker available to recovery processing on app context start - try { - broker = createBroker(true); - broker.start(); - } catch (Exception e) { - throw new RuntimeException("Failed to start broker", e); - } - - return new ClassPathXmlApplicationContext("org/apache/activemq/camel/jmsXajdbc.xml"); - } - - @Override - public void tearDown() throws Exception { - super.tearDown(); - } -} http://git-wip-us.apache.org/repos/asf/activemq/blob/bb132b13/activemq-camel/src/test/java/org/apache/activemq/camel/JmsJdbcXATest.java ---------------------------------------------------------------------- diff --git a/activemq-camel/src/test/java/org/apache/activemq/camel/JmsJdbcXATest.java b/activemq-camel/src/test/java/org/apache/activemq/camel/JmsJdbcXATest.java index 236e0a1..8481ca6 100644 --- a/activemq-camel/src/test/java/org/apache/activemq/camel/JmsJdbcXATest.java +++ b/activemq-camel/src/test/java/org/apache/activemq/camel/JmsJdbcXATest.java @@ -45,7 +45,6 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; /** * shows broker 'once only delivery' and recovery with XA */ -@Ignore("Test hangs") public class JmsJdbcXATest extends CamelSpringTestSupport { private static final Logger LOG = LoggerFactory.getLogger(JmsJdbcXATest.class); BrokerService broker = null; http://git-wip-us.apache.org/repos/asf/activemq/blob/bb132b13/activemq-camel/src/test/resources/org/apache/activemq/camel/jmsXajdbc.xml ---------------------------------------------------------------------- diff --git a/activemq-camel/src/test/resources/org/apache/activemq/camel/jmsXajdbc.xml b/activemq-camel/src/test/resources/org/apache/activemq/camel/jmsXajdbc.xml index 0fa1afb..1c58a14 100644 --- a/activemq-camel/src/test/resources/org/apache/activemq/camel/jmsXajdbc.xml +++ b/activemq-camel/src/test/resources/org/apache/activemq/camel/jmsXajdbc.xml @@ -40,7 +40,7 @@ - +