[jboss-cvs] joramtests/src/main/java/org/objectweb/jtests/jms/framework ...

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


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

  Added:       src/main/java/org/objectweb/jtests/jms/framework      
                        PubSubTestCase.java PTPTestCase.java
                        UnifiedTestCase.java JMSTestCase.java
                        TestConfig.java package.html
  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:35;  author: starksm;  state: Exp;joramtests/src/main/java/org/objectweb/jtests/jms/framework/PubSubTestCase.java
  
  Index: PubSubTestCase.java
  ===================================================================
  /*
   * JORAM: Java(TM) Open Reliable Asynchronous Messaging
   * Copyright (C) 2002 INRIA
   * Contact: joram-team at objectweb.org
   * 
   * This library 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 any later version.
   * 
   * This library 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 library; if not, write to the Free Software
   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
   * USA
   * 
   * Initial developer(s): Jeff Mesnil (jmesnil at inrialpes.fr)
   * Contributor(s): ______________________________________.
   */
  
  package org.objectweb.jtests.jms.framework;
  
  import java.util.Properties;
  
  import javax.jms.Session;
  import javax.jms.Topic;
  import javax.jms.TopicConnection;
  import javax.jms.TopicConnectionFactory;
  import javax.jms.TopicPublisher;
  import javax.jms.TopicSession;
  import javax.jms.TopicSubscriber;
  import javax.naming.InitialContext;
  
  import org.jboss.util.NestedRuntimeException;
  import org.objectweb.jtests.jms.admin.Admin;
  import org.objectweb.jtests.jms.admin.AdminFactory;
  
  /**
   * Creates convenient JMS Publish/Subscribe objects which can be needed for tests.
   * <br />
   * This class defines the setUp and tearDown methods so
   * that JMS administrated objects and  other "ready to use" Pub/Sub objects (that is to say topics,
   * sessions, publishers and subscribers) are available conveniently for the test cases.
   * <br />
   * Classes which want that convenience should extend <code>PubSubTestCase</code> instead of 
   * <code>JMSTestCase</code>.
   *
   * @author Jeff Mesnil (jmesnil at inrialpes.fr)
   * @version $Id: PubSubTestCase.java,v 1.1 2007/03/29 04:28:35 starksm Exp $
   */
  public class PubSubTestCase extends JMSTestCase
  {
  
     private Admin admin;
  
     private InitialContext ctx;
  
     private static final String TCF_NAME = "testTCF";
  
     private static final String TOPIC_NAME = "testJoramTopic";
  
     /**
      * Topic used by a publisher
      */
     protected Topic publisherTopic;
  
     /**
      * Publisher on queue
      */
     protected TopicPublisher publisher;
  
     /**
      * TopicConnectionFactory of the publisher
      */
     protected TopicConnectionFactory publisherTCF;
  
     /**
      * TopicConnection of the publisher
      */
     protected TopicConnection publisherConnection;
  
     /**
      * TopicSession of the publisher (non transacted, AUTO_ACKNOWLEDGE)
      */
     protected TopicSession publisherSession;
  
     /**
      * Topic used by a subscriber
      */
     protected Topic subscriberTopic;
  
     /**
      * Subscriber on queue
      */
     protected TopicSubscriber subscriber;
  
     /**
      * TopicConnectionFactory of the subscriber
      */
     protected TopicConnectionFactory subscriberTCF;
  
     /**
      * TopicConnection of the subscriber
      */
     protected TopicConnection subscriberConnection;
  
     /**
      * TopicSession of the subscriber (non transacted, AUTO_ACKNOWLEDGE)
      */
     protected TopicSession subscriberSession;
  
     /**
      * Create all administrated objects connections and sessions ready to use for tests.
      * <br />
      * Start connections.
      */
     protected void setUp()
     {
        try
        {
           // Admin step
           // gets the provider administration wrapper...
       	 Properties props = getProviderProperties();
           admin = AdminFactory.getAdmin(props);
           // ...and creates administrated objects and binds them
           admin.createTopicConnectionFactory(TCF_NAME);
           admin.createTopic(TOPIC_NAME);
  
           // end of admin step, start of JMS client step
           ctx = admin.createInitialContext();
  
           publisherTCF = (TopicConnectionFactory) ctx.lookup(TCF_NAME);
           publisherTopic = (Topic) ctx.lookup(TOPIC_NAME);
           publisherConnection = publisherTCF.createTopicConnection();
           if (publisherConnection.getClientID() == null)
           {
              publisherConnection.setClientID("publisherConnection");
           }
           publisherSession = publisherConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
           publisher = publisherSession.createPublisher(publisherTopic);
  
           subscriberTCF = (TopicConnectionFactory) ctx.lookup(TCF_NAME);
           subscriberTopic = (Topic) ctx.lookup(TOPIC_NAME);
           subscriberConnection = subscriberTCF.createTopicConnection();
           if (subscriberConnection.getClientID() == null)
           {
              subscriberConnection.setClientID("subscriberConnection");
           }
           subscriberSession = subscriberConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
           subscriber = subscriberSession.createSubscriber(subscriberTopic);
  
           publisherConnection.start();
           subscriberConnection.start();
           //end of client step
        }
        catch (Exception e)
        {
           throw new NestedRuntimeException(e);
        }
     }
  
     /**
      *  Close connections and delete administrated objects
      */
     protected void tearDown()
     {
        try
        {
           publisherConnection.close();
           subscriberConnection.close();
  
           admin.deleteTopicConnectionFactory(TCF_NAME);
           admin.deleteTopic(TOPIC_NAME);
        }
        catch (Exception ignored)
        {
        }
        finally
        {
           publisherTopic = null;
           publisher = null;
           publisherTCF = null;
           publisherSession = null;
           publisherConnection = null;
  
           subscriberTopic = null;
           subscriber = null;
           subscriberTCF = null;
           subscriberSession = null;
           subscriberConnection = null;
        }
     }
  
     public PubSubTestCase(String name)
     {
        super(name);
     }
  }
  
  
  
  1.1      date: 2007/03/29 04:28:35;  author: starksm;  state: Exp;joramtests/src/main/java/org/objectweb/jtests/jms/framework/PTPTestCase.java
  
  Index: PTPTestCase.java
  ===================================================================
  /*
   * JORAM: Java(TM) Open Reliable Asynchronous Messaging
   * Copyright (C) 2002 INRIA
   * Contact: joram-team at objectweb.org
   * 
   * This library 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 any later version.
   * 
   * This library 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 library; if not, write to the Free Software
   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
   * USA
   * 
   * Initial developer(s): Jeff Mesnil (jmesnil at inrialpes.fr)
   * Contributor(s): ______________________________________.
   */
  
  package org.objectweb.jtests.jms.framework;
  
  import java.util.Properties;
  
  import javax.jms.Queue;
  import javax.jms.QueueConnection;
  import javax.jms.QueueConnectionFactory;
  import javax.jms.QueueReceiver;
  import javax.jms.QueueSender;
  import javax.jms.QueueSession;
  import javax.jms.Session;
  import javax.naming.InitialContext;
  
  import org.jboss.util.NestedRuntimeException;
  import org.objectweb.jtests.jms.admin.Admin;
  import org.objectweb.jtests.jms.admin.AdminFactory;
  
  /**
   * Creates convenient Point to Point JMS objects which can be needed for tests.
   * <br />
   * This class defines the setUp and tearDown methods so
   * that JMS administrated objects and  other "ready to use" PTP objects (that is to say queues,
   * sessions, senders and receviers) are available conveniently for the test cases.
   * <br />
   * Classes which want that convenience should extend <code>PTPTestCase</code> instead of 
   * <code>JMSTestCase</code>.
   *
   * @author Jeff Mesnil (jmesnil at inrialpes.fr)
   * @version $Id: PTPTestCase.java,v 1.1 2007/03/29 04:28:35 starksm Exp $
   */
  public class PTPTestCase extends JMSTestCase
  {
  
     protected Admin admin;
  
     protected InitialContext ctx;
  
     private static final String QCF_NAME = "testQCF";
  
     private static final String QUEUE_NAME = "testJoramQueue";
  
     /**
      * Queue used by a sender
      */
     protected Queue senderQueue;
  
     /**
      * Sender on queue
      */
     protected QueueSender sender;
  
     /**
      * QueueConnectionFactory of the sender
      */
     protected QueueConnectionFactory senderQCF;
  
     /**
      * QueueConnection of the sender
      */
     protected QueueConnection senderConnection;
  
     /**
      * QueueSession of the sender (non transacted, AUTO_ACKNOWLEDGE)
      */
     protected QueueSession senderSession;
  
     /**
      * Queue used by a receiver
      */
     protected Queue receiverQueue;
  
     /**
      * Receiver on queue
      */
     protected QueueReceiver receiver;
  
     /**
      * QueueConnectionFactory of the receiver
      */
     protected QueueConnectionFactory receiverQCF;
  
     /**
      * QueueConnection of the receiver
      */
     protected QueueConnection receiverConnection;
  
     /**
      * QueueSession of the receiver (non transacted, AUTO_ACKNOWLEDGE)
      */
     protected QueueSession receiverSession;
  
     /**
      * Create all administrated objects connections and sessions ready to use for tests.
      * <br />
      * Start connections.
      */
     protected void setUp()
     {
        try
        {
           // Admin step
           // gets the provider administration wrapper...
      	 Properties props = getProviderProperties();
           admin = AdminFactory.getAdmin(props);
           // ...and creates administrated objects and binds them
           admin.createQueueConnectionFactory(QCF_NAME);
           admin.createQueue(QUEUE_NAME);
  
           // end of admin step, start of JMS client step
           ctx = admin.createInitialContext();
  
           senderQCF = (QueueConnectionFactory) ctx.lookup(QCF_NAME);
           senderQueue = (Queue) ctx.lookup(QUEUE_NAME);
           senderConnection = senderQCF.createQueueConnection();
           senderSession = senderConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
           sender = senderSession.createSender(senderQueue);
  
           receiverQCF = (QueueConnectionFactory) ctx.lookup(QCF_NAME);
           receiverQueue = (Queue) ctx.lookup(QUEUE_NAME);
           receiverConnection = receiverQCF.createQueueConnection();
           receiverSession = receiverConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
           receiver = receiverSession.createReceiver(receiverQueue);
  
           senderConnection.start();
           receiverConnection.start();
           //end of client step
        }
        catch (Exception e)
        {
           throw new NestedRuntimeException(e);
        }
     }
  
     /**
      *  Close connections and delete administrated objects
      */
     protected void tearDown()
     {
        try
        {
           senderConnection.close();
           receiverConnection.close();
  
           admin.deleteQueueConnectionFactory(QCF_NAME);
           admin.deleteQueue(QUEUE_NAME);
        }
        catch (Exception ignored)
        {
        }
        finally
        {
           senderQueue = null;
           sender = null;
           senderQCF = null;
           senderSession = null;
           senderConnection = null;
  
           receiverQueue = null;
           receiver = null;
           receiverQCF = null;
           receiverSession = null;
           receiverConnection = null;
        }
     }
  
     public PTPTestCase(String name)
     {
        super(name);
     }
  }
  
  
  
  1.1      date: 2007/03/29 04:28:35;  author: starksm;  state: Exp;joramtests/src/main/java/org/objectweb/jtests/jms/framework/UnifiedTestCase.java
  
  Index: UnifiedTestCase.java
  ===================================================================
  /*
   * JORAM: Java(TM) Open Reliable Asynchronous Messaging
   * Copyright (C) 2002 INRIA
   * Contact: joram-team at objectweb.org
   * 
   * This library 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 any later version.
   * 
   * This library 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 library; if not, write to the Free Software
   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
   * USA
   * 
   * Initial developer(s): Jeff Mesnil (jmesnil at inrialpes.fr)
   * Contributor(s): ______________________________________.
   */
  
  package org.objectweb.jtests.jms.framework;
  
  import java.util.Properties;
  
  import javax.jms.Connection;
  import javax.jms.ConnectionFactory;
  import javax.jms.Destination;
  import javax.jms.MessageConsumer;
  import javax.jms.MessageProducer;
  import javax.jms.Queue;
  import javax.jms.QueueConnectionFactory;
  import javax.jms.Session;
  import javax.jms.Topic;
  import javax.jms.TopicConnectionFactory;
  import javax.naming.InitialContext;
  
  import org.jboss.util.NestedRuntimeException;
  import org.objectweb.jtests.jms.admin.Admin;
  import org.objectweb.jtests.jms.admin.AdminFactory;
  
  /**
   * Creates convenient Unified JMS 1.1 objects which can be needed for tests.
   * <br />
   * This class defines the setUp and tearDown methods so
   * that JMS administrated objects and  other "ready to use" JMS objects (that is to say destinations,
   * sessions, producers and consumers) are available conveniently for the test cases.
   * <br />
   * Classes which want that convenience should extend <code>UnifiedTestCase</code> instead of 
   * <code>JMSTestCase</code>.
   *
   * @author Jeff Mesnil (jmesnil at inrialpes.fr)
   * @version $Id: UnifiedTestCase.java,v 1.1 2007/03/29 04:28:35 starksm Exp $
   * @since JMS 1.1
   */
  public class UnifiedTestCase extends JMSTestCase
  {
  
     protected Admin admin;
  
     protected InitialContext ctx;
  
     private static final String CF_NAME = "testCF";
  
     private static final String TCF_NAME = "testTCF";
  
     private static final String QCF_NAME = "testQCF";
  
     private static final String DESTINATION_NAME = "testDestination";
  
     private static final String QUEUE_NAME = "testJoramQueue";
  
     private static final String TOPIC_NAME = "testJoramTopic";
  
     ////////////////////
     // Unified Domain //
     ////////////////////
  
     /**
      * Destination used by a producer
      */
     protected Destination producerDestination;
  
     /**
      * Producer
      */
     protected MessageProducer producer;
  
     /**
      * ConnectionFactory of the producer
      */
     protected ConnectionFactory producerCF;
  
     /**
      * Connection of the producer
      */
     protected Connection producerConnection;
  
     /**
      * Session of the producer (non transacted, AUTO_ACKNOWLEDGE)
      */
     protected Session producerSession;
  
     /**
      * Destination used by a consumer
      */
     protected Destination consumerDestination;
  
     /**
      * Consumer on destination
      */
     protected MessageConsumer consumer;
  
     /**
      * ConnectionFactory of the consumer
      */
     protected ConnectionFactory consumerCF;
  
     /**
      * Connection of the consumer
      */
     protected Connection consumerConnection;
  
     /**
      * Session of the consumer (non transacted, AUTO_ACKNOWLEDGE)
      */
     protected Session consumerSession;
  
     ////////////////
     // PTP Domain //
     ////////////////
  
     /**
      * QueueConnectionFactory
      */
     protected QueueConnectionFactory queueConnectionFactory;
  
     /**
      * Queue
      */
     protected Queue queue;
  
     ////////////////////
     // Pub/Sub Domain //
     ////////////////////
  
     /**
      * TopicConnectionFactory
      */
     protected TopicConnectionFactory topicConnectionFactory;
  
     /**
      * Topic
      */
     protected Topic topic;
  
     /**
      * Create all administrated objects connections and sessions ready to use for tests.
      * <br />
      * Start connections.
      */
     protected void setUp()
     {
        try
        {
           // Admin step
           // gets the provider administration wrapper...
        	 Properties props = getProviderProperties();
           admin = AdminFactory.getAdmin(props);
           // ...and creates administrated objects and binds them
           admin.createConnectionFactory(CF_NAME);
           admin.createQueueConnectionFactory(QCF_NAME);
           admin.createTopicConnectionFactory(TCF_NAME);
           // destination for unified domain is a queue
           admin.createQueue(DESTINATION_NAME);
           admin.createQueue(QUEUE_NAME);
           admin.createTopic(TOPIC_NAME);
  
           // end of admin step, start of JMS client step
           ctx = admin.createInitialContext();
  
           producerCF = (ConnectionFactory) ctx.lookup(CF_NAME);
           // we see destination of the unified domain as a javax.jms.Destination
           // instead of a javax.jms.Queue to be more generic
           producerDestination = (Destination) ctx.lookup(DESTINATION_NAME);
           producerConnection = producerCF.createConnection();
           producerSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
           producer = producerSession.createProducer(producerDestination);
  
           consumerCF = (ConnectionFactory) ctx.lookup(CF_NAME);
           // we see destination of the unified domain as a javax.jms.Destination
           // instead of a javax.jms.Queue to be more generic
           consumerDestination = (Destination) ctx.lookup(DESTINATION_NAME);
           consumerConnection = consumerCF.createConnection();
           consumerSession = consumerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
           consumer = consumerSession.createConsumer(consumerDestination);
  
           queueConnectionFactory = (QueueConnectionFactory) ctx.lookup(QCF_NAME);
           queue = (Queue) ctx.lookup(QUEUE_NAME);
  
           topicConnectionFactory = (TopicConnectionFactory) ctx.lookup(TCF_NAME);
           topic = (Topic) ctx.lookup(TOPIC_NAME);
  
           producerConnection.start();
           consumerConnection.start();
           //end of client step
        }
        catch (Exception e)
        {
           throw new NestedRuntimeException(e);
        }
     }
  
     /**
      *  Close connections and delete administrated objects
      */
     protected void tearDown()
     {
        try
        {
           consumerConnection.close();
           producerConnection.close();
  
           admin.deleteConnectionFactory(CF_NAME);
           admin.deleteQueueConnectionFactory(QCF_NAME);
           admin.deleteTopicConnectionFactory(TCF_NAME);
           admin.deleteQueue(DESTINATION_NAME);
           admin.deleteQueue(QUEUE_NAME);
           admin.deleteTopic(TOPIC_NAME);
        }
        catch (Exception ignored)
        {
        }
        finally
        {
           producerDestination = null;
           producer = null;
           producerCF = null;
           producerSession = null;
           producerConnection = null;
  
           consumerDestination = null;
           consumer = null;
           consumerCF = null;
           consumerSession = null;
           consumerConnection = null;
  
           queueConnectionFactory = null;
           queue = null;
  
           topicConnectionFactory = null;
           topic = null;
        }
     }
  
     public UnifiedTestCase(String name)
     {
        super(name);
     }
  }
  
  
  
  1.1      date: 2007/03/29 04:28:35;  author: starksm;  state: Exp;joramtests/src/main/java/org/objectweb/jtests/jms/framework/JMSTestCase.java
  
  Index: JMSTestCase.java
  ===================================================================
  /*
   * JORAM: Java(TM) Open Reliable Asynchronous Messaging
   * Copyright (C) 2002 INRIA
   * Contact: joram-team at objectweb.org
   * 
   * This library 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 any later version.
   * 
   * This library 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 library; if not, write to the Free Software
   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
   * USA
   * 
   * Initial developer(s): Jeff Mesnil (jmesnil at inrialpes.fr)
   * Contributor(s): ______________________________________.
   */
  
  package org.objectweb.jtests.jms.framework;
  
  import java.io.IOException;
  import java.util.Properties;
  
  import javax.jms.JMSException;
  
  import junit.framework.TestCase;
  
  /**
   * Class extending <code>junit.framework.TestCase</code> to
   * provide a new <code>fail()</code> method with an <code>Exception</code>
   * as parameter.
   *<br />
   * Every Test Case for JMS should extend this class instead of <code>junit.framework.TestCase</code>
   *
   * @author Jeff Mesnil (jmesnil at inrialpes.fr)
   * @version $Id: JMSTestCase.java,v 1.1 2007/03/29 04:28:35 starksm Exp $
   */
  public class JMSTestCase extends TestCase
  {
     /**
      * Fails a test with an exception which will be used for a message.
      * 
      * If the exception is an instance of <code>javax.jms.JMSException</code>, the
      * message of the failure will contained both the JMSException and its linked exception
      * (provided there's one).
      */
     public void fail(Exception e)
     {
        if (e instanceof javax.jms.JMSException)
        {
           JMSException exception = (JMSException) e;
           String message = e.toString();
           Exception linkedException = exception.getLinkedException();
           if (linkedException != null)
           {
              message += " [linked exception: " + linkedException + "]";
           }
           super.fail(message);
        }
        else
        {
           super.fail(e.getMessage());
        }
     }
  
     public JMSTestCase(String name)
     {
        super(name);
     }
  
     /**
      * Should be overriden 
      * @return
      */
     protected Properties getProviderProperties()
     throws IOException
     {
  	   return System.getProperties();
     }
  
  }
  
  
  
  1.1      date: 2007/03/29 04:28:35;  author: starksm;  state: Exp;joramtests/src/main/java/org/objectweb/jtests/jms/framework/TestConfig.java
  
  Index: TestConfig.java
  ===================================================================
  /*
   * JORAM: Java(TM) Open Reliable Asynchronous Messaging
   * Copyright (C) 2002 INRIA
   * Contact: joram-team at objectweb.org
   * 
   * This library 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 any later version.
   * 
   * This library 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 library; if not, write to the Free Software
   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
   * USA
   * 
   * Initial developer(s): Jeff Mesnil (jmesnil at inrialpes.fr)
   * Contributor(s): ______________________________________.
   */
  
  package org.objectweb.jtests.jms.framework;
  
  import java.util.Properties;
  
  /**
   * Class used to provide configurable options in a convenient way
   *
   * @author Jeff Mesnil (jmesnil at inrialpes.fr)
   * @version $Id: TestConfig.java,v 1.1 2007/03/29 04:28:35 starksm Exp $
   */
  public class TestConfig
  {
     // name of the configuration file
     private static final String PROP_FILE_NAME = "test.properties";
  
     // name of the timeout property
     private static final String PROP_NAME = "timeout";
  
     /**
      * timeout value used by <code>receive</code> method in the tests. 
      * the value is specified in the <code>config/test.properties</code> file.
      */
     public static final long TIMEOUT;
  
     static
     {
        // load tests.properties	 
        long tempTimeOut = 0;
        try
        {
           Properties props = new Properties();
           props.load(ClassLoader.getSystemResourceAsStream(PROP_FILE_NAME));
           tempTimeOut = Long.parseLong(props.getProperty(PROP_NAME, "0"));
        }
        catch (Exception e)
        {
           tempTimeOut = 0;
        }
        finally
        {
           TIMEOUT = tempTimeOut;
        }
     }
  }
  
  
  
  1.1      date: 2007/03/29 04:28:35;  author: starksm;  state: Exp;joramtests/src/main/java/org/objectweb/jtests/jms/framework/package.html
  
  Index: package.html
  ===================================================================
  <body>
  Extension of JUnit Testing framework to take into account JMS specific features.
  </body>
  
  
  



More information about the jboss-cvs-commits mailing list