[jboss-cvs] joramtests/src/main/java/org/jboss/test/jms ...

Scott Stark scott.stark at jboss.com
Thu Mar 29 00:28:36 EDT 2007


  User: starksm 
  Date: 07/03/29 00:28:36

  Added:       src/main/java/org/jboss/test/jms     JoramTestDelegate.java
                        JoramUnitTestCase.java AbstractAdmin.java
                        GenericAdmin.java
  Log:
  + covert to mvn
  + Drop the poor properties file setup logic and require that the properties be passed in
  
  Revision  Changes    Path
  1.1      date: 2007/03/29 04:28:36;  author: starksm;  state: Exp;joramtests/src/main/java/org/jboss/test/jms/JoramTestDelegate.java
  
  Index: JoramTestDelegate.java
  ===================================================================
  /*
  * JBoss, Home of Professional Open Source
  * Copyright 2005, JBoss Inc., and individual contributors as indicated
  * by the @authors tag. See the copyright.txt in the distribution for a
  * full listing of individual contributors.
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as
  * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
  package org.jboss.test.jms;
  
  import java.lang.reflect.Constructor;
  
  import org.jboss.test.AbstractTestDelegate;
  
  /**
   * JoramTestDelegate.
   * 
   * @author <a href="adrian at jboss.com">Adrian Brock</a>
   * @version $Revision: 1.1 $
   */
  public class JoramTestDelegate extends AbstractTestDelegate
  {
     protected String adminName;
     
     public JoramTestDelegate(Class clazz, String adminName)
     {
        super(clazz);
        this.adminName = adminName;
     }
  
     public void setUp() throws Exception
     {
        super.setUp();
        Class adminClass = Thread.currentThread().getContextClassLoader().loadClass(adminName);
        Constructor constructor = adminClass.getConstructor(new Class[] { Class.class });
        AbstractAdmin admin = (AbstractAdmin) constructor.newInstance(new Object[] { clazz } );
        GenericAdmin.delegate = admin; 
     }
  }
  
  
  
  1.1      date: 2007/03/29 04:28:36;  author: starksm;  state: Exp;joramtests/src/main/java/org/jboss/test/jms/JoramUnitTestCase.java
  
  Index: JoramUnitTestCase.java
  ===================================================================
  /*
  * JBoss, Home of Professional Open Source
  * Copyright 2005, JBoss Inc., and individual contributors as indicated
  * by the @authors tag. See the copyright.txt in the distribution for a
  * full listing of individual contributors.
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as
  * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
  package org.jboss.test.jms;
  
  import junit.framework.Test;
  import junit.framework.TestSuite;
  
  import org.jboss.test.AbstractTestCaseWithSetup;
  import org.jboss.test.AbstractTestSetup;
  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;
  
  /**
   * JoramUnitTestCase.
   * 
   * @author <a href="adrian at jboss.com">Adrian Brock</a>
   * @version $Revision: 1.1 $
   */
  public class JoramUnitTestCase extends AbstractTestCaseWithSetup
  {
     public JoramUnitTestCase(String name)
     {
        super(name);
     }
  
     /**
      * Get the test delegate
      * 
      * @param clazz the test class
      * @param adminName the admin name
      * @return the delegate
      * @throws Exception for any error
      */
     public static JoramTestDelegate getDelegate(Class clazz, String adminName) throws Exception
     {
        return new JoramTestDelegate(clazz, adminName);
     }
  
     public static Test getTestSuite(Class clazz) throws Exception
     {
        TestSuite suite = new TestSuite();
        suite.addTest(ConnectionTest.suite());
        suite.addTest(TopicConnectionTest.suite());
        suite.addTest(MessageBodyTest.suite());
        suite.addTest(MessageDefaultTest.suite());
        suite.addTest(MessageTypeTest.suite());
        suite.addTest(MessageHeaderTest.suite());
        suite.addTest(JMSXPropertyTest.suite());
        suite.addTest(MessagePropertyConversionTest.suite());
        suite.addTest(MessagePropertyTest.suite());
        suite.addTest(QueueBrowserTest.suite());
        suite.addTest(TemporaryQueueTest.suite());
        suite.addTest(SelectorSyntaxTest.suite());
        suite.addTest(SelectorTest.suite());
        suite.addTest(QueueSessionTest.suite());
        suite.addTest(SessionTest.suite());
        suite.addTest(TopicSessionTest.suite());
        suite.addTest(UnifiedSessionTest.suite());
        suite.addTest(TemporaryTopicTest.suite());
        return new AbstractTestSetup(clazz, suite);
     }
  }
  
  
  
  1.1      date: 2007/03/29 04:28:36;  author: starksm;  state: Exp;joramtests/src/main/java/org/jboss/test/jms/AbstractAdmin.java
  
  Index: AbstractAdmin.java
  ===================================================================
  /*
  * JBoss, Home of Professional Open Source
  * Copyright 2005, JBoss Inc., and individual contributors as indicated
  * by the @authors tag. See the copyright.txt in the distribution for a
  * full listing of individual contributors.
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as
  * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
  package org.jboss.test.jms;
  
  import javax.naming.InitialContext;
  import javax.naming.NamingException;
  
  import org.jboss.util.NotImplementedException;
  import org.objectweb.jtests.jms.admin.Admin;
  
  /**
   * AbstractAdmin.
   * 
   * @author <a href="adrian at jboss.com">Adrian Brock</a>
   * @version $Revision: 1.1 $
   */
  public class AbstractAdmin implements Admin
  {
     public String getName()
     {
        return getClass().getName();
     }
  
     public InitialContext createInitialContext() throws NamingException
     {
        return new InitialContext();
     }
     
     public void createConnectionFactory(String name)
     {
        throw new NotImplementedException("FIXME NYI createConnectionFactory");
     }
  
     public void deleteConnectionFactory(String name)
     {
        throw new NotImplementedException("FIXME NYI deleteConnectionFactory");
     }
  
     public void createQueue(String name)
     {
        throw new NotImplementedException("FIXME NYI createQueue");
     }
  
     public void deleteQueue(String name)
     {
        throw new NotImplementedException("FIXME NYI deleteQueue");
     }
  
     public void createQueueConnectionFactory(String name)
     {
        createConnectionFactory(name);
     }
  
     public void deleteQueueConnectionFactory(String name)
     {
        deleteConnectionFactory(name);
     }
  
     public void createTopic(String name)
     {
        throw new NotImplementedException("FIXME NYI createTopic");
     }
  
     public void deleteTopic(String name)
     {
        throw new NotImplementedException("FIXME NYI deleteTopic");
     }
  
     public void createTopicConnectionFactory(String name)
     {
        createConnectionFactory(name);
     }
  
     public void deleteTopicConnectionFactory(String name)
     {
        deleteConnectionFactory(name);
     }
  }
  
  
  
  1.1      date: 2007/03/29 04:28:36;  author: starksm;  state: Exp;joramtests/src/main/java/org/jboss/test/jms/GenericAdmin.java
  
  Index: GenericAdmin.java
  ===================================================================
  /*
  * JBoss, Home of Professional Open Source
  * Copyright 2005, JBoss Inc., and individual contributors as indicated
  * by the @authors tag. See the copyright.txt in the distribution for a
  * full listing of individual contributors.
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as
  * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
  package org.jboss.test.jms;
  
  import javax.naming.InitialContext;
  import javax.naming.NamingException;
  
  import org.jboss.logging.Logger;
  import org.objectweb.jtests.jms.admin.Admin;
  
  /**
   * GenericAdmin.
   * 
   * @FIXME delegate to a JBoss defined admin class
   * @author <a href="adrian at jboss.com">Adrian Brock</a>
   * @version $Revision: 1.1 $
   */
  public class GenericAdmin implements Admin
  {
     public static final Logger log = Logger.getLogger(GenericAdmin.class);
     
     public static Admin delegate = new AbstractAdmin();
  
     public String getName()
     {
        String name = delegate.getName();
        log.debug("Using admin '" + name + "' delegate=" + delegate);
        return name;
     }
     
     public InitialContext createInitialContext() throws NamingException
     {
        InitialContext ctx = delegate.createInitialContext();
        log.debug("Using initial context: " + ctx.getEnvironment());
        return ctx;
     }
  
     public void createConnectionFactory(String name)
     {
        log.debug("createConnectionFactory '" + name + "'");
        delegate.createConnectionFactory(name);
     }
  
     public void deleteConnectionFactory(String name)
     {
        log.debug("deleteConnectionFactory '" + name + "'");
        delegate.deleteConnectionFactory(name);
     }
  
     public void createQueue(String name)
     {
        log.debug("createQueue '" + name + "'");
        delegate.createQueue(name);
     }
  
     public void deleteQueue(String name)
     {
        log.debug("deleteQueue '" + name + "'");
        delegate.deleteQueue(name);
     }
  
     public void createQueueConnectionFactory(String name)
     {
        log.debug("createQueueConnectionFactory '" + name + "'");
        delegate.createQueueConnectionFactory(name);
     }
  
     public void deleteQueueConnectionFactory(String name)
     {
        log.debug("deleteQueueConnectionFactory '" + name + "'");
        delegate.deleteQueueConnectionFactory(name);
     }
  
     public void createTopic(String name)
     {
        log.debug("createTopic '" + name + "'");
        delegate.createTopic(name);
     }
  
     public void deleteTopic(String name)
     {
        log.debug("deleteTopic '" + name + "'");
        delegate.deleteTopic(name);
     }
  
     public void createTopicConnectionFactory(String name)
     {
        log.debug("createTopicConnectionFactory '" + name + "'");
        delegate.createTopicConnectionFactory(name);
     }
  
     public void deleteTopicConnectionFactory(String name)
     {
        log.debug("deleteTopicConnectionFactory '" + name + "'");
        delegate.deleteTopicConnectionFactory(name);
     }
  }
  
  
  



More information about the jboss-cvs-commits mailing list