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 6D4C6D538 for ; Wed, 25 Jul 2012 14:50:32 +0000 (UTC) Received: (qmail 88490 invoked by uid 500); 25 Jul 2012 14:50:32 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 88350 invoked by uid 500); 25 Jul 2012 14:50:28 -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 88322 invoked by uid 99); 25 Jul 2012 14:50:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Jul 2012 14:50:27 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Jul 2012 14:50:25 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 1402D2388906 for ; Wed, 25 Jul 2012 14:49:42 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1365608 - in /activemq/trunk/activemq-core: ./ src/test/java/org/apache/activemq/joramtests/ src/test/resources/ Date: Wed, 25 Jul 2012 14:49:41 -0000 To: commits@activemq.apache.org From: chirino@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120725144942.1402D2388906@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: chirino Date: Wed Jul 25 14:49:41 2012 New Revision: 1365608 URL: http://svn.apache.org/viewvc?rev=1365608&view=rev Log: Implements AMQ-3944 : Test against the Joram JMS conformance tests. Added: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/joramtests/ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/joramtests/ActiveMQAdmin.java activemq/trunk/activemq-core/src/test/java/org/apache/activemq/joramtests/JoramJmsTest.java activemq/trunk/activemq-core/src/test/resources/provider.properties activemq/trunk/activemq-core/src/test/resources/test.properties Modified: activemq/trunk/activemq-core/pom.xml Modified: activemq/trunk/activemq-core/pom.xml URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/pom.xml?rev=1365608&r1=1365607&r2=1365608&view=diff ============================================================================== --- activemq/trunk/activemq-core/pom.xml (original) +++ activemq/trunk/activemq-core/pom.xml Wed Jul 25 14:49:41 2012 @@ -248,6 +248,20 @@ test + + + org.fusesource.joram-jms-tests + joram-jms-tests + 1.0 + test + + + + org.eclipse.jetty.aggregate + jetty-all-server + test + + org.apache.directory.server Added: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/joramtests/ActiveMQAdmin.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/joramtests/ActiveMQAdmin.java?rev=1365608&view=auto ============================================================================== --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/joramtests/ActiveMQAdmin.java (added) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/joramtests/ActiveMQAdmin.java Wed Jul 25 14:49:41 2012 @@ -0,0 +1,148 @@ +/** + * 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.joramtests; + +import org.apache.activemq.ActiveMQConnectionFactory; +import org.apache.activemq.broker.BrokerFactory; +import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.command.ActiveMQQueue; +import org.apache.activemq.command.ActiveMQTopic; +import org.objectweb.jtests.jms.admin.Admin; + +import javax.jms.ConnectionFactory; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import java.io.File; +import java.net.URI; +import java.util.Hashtable; + +/** + * + * @author Hiram Chirino + */ +public class ActiveMQAdmin implements Admin { + + Context context; + { + try { + // Use the jetty JNDI context since it's mutable. + final Hashtable env = new Hashtable(); + env.put("java.naming.factory.initial", "org.eclipse.jetty.jndi.InitialContextFactory"); + env.put("java.naming.factory.url.pkgs", "org.eclipse.jetty.jndi");; + context = new InitialContext(env); + } catch (NamingException e) { + throw new RuntimeException(e); + } + } + + protected BrokerService createBroker() throws Exception { + return BrokerFactory.createBroker(new URI("broker://()/localhost?persistent=false")); + } + + public String getName() { + return getClass().getName(); + } + + BrokerService broker; + public void startServer() throws Exception { + if (System.getProperty("basedir") == null) { + File file = new File("."); + System.setProperty("basedir", file.getAbsolutePath()); + } + broker = createBroker(); + broker.start(); + } + + public void stopServer() throws Exception { + broker.stop(); + } + + public void start() throws Exception { + } + + public void stop() throws Exception { + } + + public Context createContext() throws NamingException { + return context; + } + + public void createQueue(String name) { + try { + context.bind(name, new ActiveMQQueue(name)); + } catch (NamingException e) { + throw new RuntimeException(e); + } + } + + public void createTopic(String name) { + try { + context.bind(name, new ActiveMQTopic(name)); + } catch (NamingException e) { + throw new RuntimeException(e); + } + } + + public void deleteQueue(String name) { + // BrokerTestSupport.delete_queue((Broker)base.broker, name); + try { + context.unbind(name); + } catch (NamingException e) { + throw new RuntimeException(e); + } + } + + public void deleteTopic(String name) { + try { + context.unbind(name); + } catch (NamingException e) { + throw new RuntimeException(e); + } + } + + public void createConnectionFactory(String name) { + try { + final ConnectionFactory factory = new ActiveMQConnectionFactory("vm://localhost"); + context.bind(name, factory); + } catch (NamingException e) { + throw new RuntimeException(e); + } + } + + public void deleteConnectionFactory(String name) { + try { + context.unbind(name); + } catch (NamingException e) { + throw new RuntimeException(e); + } + } + + public void createQueueConnectionFactory(String name) { + createConnectionFactory(name); + } + public void createTopicConnectionFactory(String name) { + createConnectionFactory(name); + } + public void deleteQueueConnectionFactory(String name) { + deleteConnectionFactory(name); + } + public void deleteTopicConnectionFactory(String name) { + deleteConnectionFactory(name); + } + +} Added: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/joramtests/JoramJmsTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/joramtests/JoramJmsTest.java?rev=1365608&view=auto ============================================================================== --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/joramtests/JoramJmsTest.java (added) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/joramtests/JoramJmsTest.java Wed Jul 25 14:49:41 2012 @@ -0,0 +1,74 @@ +/** + * 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.joramtests; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; +import org.objectweb.jtests.jms.conform.connection.ConnectionTest; +import org.objectweb.jtests.jms.conform.connection.TopicConnectionTest; +import org.objectweb.jtests.jms.conform.message.MessageBodyTest; +import org.objectweb.jtests.jms.conform.message.MessageDefaultTest; +import org.objectweb.jtests.jms.conform.message.MessageTypeTest; +import org.objectweb.jtests.jms.conform.message.headers.MessageHeaderTest; +import org.objectweb.jtests.jms.conform.message.properties.JMSXPropertyTest; +import org.objectweb.jtests.jms.conform.message.properties.MessagePropertyConversionTest; +import org.objectweb.jtests.jms.conform.message.properties.MessagePropertyTest; +import org.objectweb.jtests.jms.conform.queue.QueueBrowserTest; +import org.objectweb.jtests.jms.conform.queue.TemporaryQueueTest; +import org.objectweb.jtests.jms.conform.selector.SelectorSyntaxTest; +import org.objectweb.jtests.jms.conform.selector.SelectorTest; +import org.objectweb.jtests.jms.conform.session.QueueSessionTest; +import org.objectweb.jtests.jms.conform.session.SessionTest; +import org.objectweb.jtests.jms.conform.session.TopicSessionTest; +import org.objectweb.jtests.jms.conform.session.UnifiedSessionTest; +import org.objectweb.jtests.jms.conform.topic.TemporaryTopicTest; + +/** + * @author Hiram Chirino + */ +public class JoramJmsTest extends TestCase { + + public static Test suite() { + TestSuite suite = new TestSuite(); + suite.addTestSuite(ConnectionTest.class); + suite.addTestSuite(TopicConnectionTest.class); + suite.addTestSuite(MessageHeaderTest.class); + suite.addTestSuite(MessageBodyTest.class); + suite.addTestSuite(MessageDefaultTest.class); + suite.addTestSuite(MessageTypeTest.class); + suite.addTestSuite(JMSXPropertyTest.class); + suite.addTestSuite(MessagePropertyConversionTest.class); + suite.addTestSuite(TemporaryQueueTest.class); + suite.addTestSuite(SelectorSyntaxTest.class); + suite.addTestSuite(QueueSessionTest.class); + suite.addTestSuite(SessionTest.class); + suite.addTestSuite(TopicSessionTest.class); + suite.addTestSuite(TemporaryTopicTest.class); +// TODO: figure out why the following tests are failing.. +// suite.addTestSuite(MessagePropertyTest.class); +// suite.addTestSuite(QueueBrowserTest.class); +// suite.addTestSuite(SelectorTest.class); +// suite.addTestSuite(UnifiedSessionTest.class); + return suite; + } + + public static void main(String[] args) { + junit.textui.TestRunner.run(suite()); + } + +} Added: activemq/trunk/activemq-core/src/test/resources/provider.properties URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/resources/provider.properties?rev=1365608&view=auto ============================================================================== --- activemq/trunk/activemq-core/src/test/resources/provider.properties (added) +++ activemq/trunk/activemq-core/src/test/resources/provider.properties Wed Jul 25 14:49:41 2012 @@ -0,0 +1,20 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- + +# This config file is used by the joram jms tests. +# +jms.provider.admin.class=org.apache.activemq.joramtests.ActiveMQAdmin \ No newline at end of file Added: activemq/trunk/activemq-core/src/test/resources/test.properties URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/resources/test.properties?rev=1365608&view=auto ============================================================================== --- activemq/trunk/activemq-core/src/test/resources/test.properties (added) +++ activemq/trunk/activemq-core/src/test/resources/test.properties Wed Jul 25 14:49:41 2012 @@ -0,0 +1,20 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- + +# This config file is used by the joram jms tests. +# +timeout=30000 \ No newline at end of file