User: kimptoc 
  Date: 01/05/19 16:13:11

  Modified:    src/main/org/jboss/test/jmsra/bean PublisherBean.java
                        PublisherCMPBean.java TopicPublisherBean.java
  Log:
  made method signature valid for ejb - to help debug jmsra test failing
  
  Revision  Changes    Path
  1.2       +73 -73    jbosstest/src/main/org/jboss/test/jmsra/bean/PublisherBean.java
  
  Index: PublisherBean.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbosstest/src/main/org/jboss/test/jmsra/bean/PublisherBean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PublisherBean.java        2001/04/26 21:18:52     1.1
  +++ PublisherBean.java        2001/05/19 23:13:11     1.2
  @@ -1,6 +1,6 @@
   package org.jboss.test.jmsra.bean;
   
  -import java.rmi.RemoteException; 
  +import java.rmi.RemoteException;
   import java.util.*;
   import javax.ejb.SessionBean;
   import javax.ejb.SessionContext;
  @@ -10,12 +10,12 @@
   
   
   public class PublisherBean implements SessionBean {
  -    
  +
       private static final String CONNECTION_JNDI = 
"java:comp/env/jms/MyQueueConnection";
       private static final String QUEUE_JNDI = "java:comp/env/jms/QueueName";
   
       private static final String BEAN_JNDI = "java:comp/env/ejb/PublisherCMP";
  -  
  +
       private SessionContext ctx = null;
       private Queue queue = null;
       private QueueConnection queueConnection = null;
  @@ -26,81 +26,81 @@
           this.ctx = ctx;
       }
   
  -    public void ejbCreate() throws EJBException {
  +    public void ejbCreate()  {
           try {
               Context context = new InitialContext();
               queue = (Queue)context.lookup(QUEUE_JNDI);
   
  -         QueueConnectionFactory factory = 
(QueueConnectionFactory)context.lookup(CONNECTION_JNDI);
  -         queueConnection = factory.createQueueConnection();
  -         
  +        QueueConnectionFactory factory = 
(QueueConnectionFactory)context.lookup(CONNECTION_JNDI);
  +        queueConnection = factory.createQueueConnection();
  +    
           } catch (Exception ex) {
               // JMSException or NamingException could be thrown
               ex.printStackTrace();
  -         throw new EJBException(ex.toString());
  +        throw new EJBException(ex.toString());
           }
       }
   
       /**
        * Send a message with a message nr in property MESSAGE_NR
        */
  -    public void simple(int messageNr) throws EJBException {
  -     sendMessage(messageNr);
  +    public void simple(int messageNr)  {
  +    sendMessage(messageNr);
       }
       /**
        * Try send a message with a message nr in property MESSAGE_NR,
        * but set rollback only
        */
  -    public void simpleFail(int messageNr) throws EJBException {
  -     sendMessage(messageNr);
  -     // Roll it back, no message should be sent if transactins work
  -     System.err.println("DEBUG: Setting rollbackOnly");
  -     ctx.setRollbackOnly();
  -     System.err.println("DEBUG rollback set: " + ctx.getRollbackOnly()); 
  -     
  -    }
  -
  -    public void beanOk(int messageNr) throws EJBException{
  -     // DO JMS - First transaction
  -     sendMessage(messageNr);
  -     PublisherCMPHome h = null;
  -     try {
  -         // DO entity bean - Second transaction
  -         h = (PublisherCMPHome) new InitialContext().lookup(BEAN_JNDI);
  -         PublisherCMP b = h.create(new Integer(messageNr));
  -         b.ok(messageNr);
  -     }catch(Exception ex) {
  -         throw new EJBException("OPS exception in ok: " + ex);
  -     } finally {
  -         try {
  -             h.remove(new Integer(messageNr));
  -         }catch(Exception e) {
  -             e.printStackTrace();
  -         }
  -     }
  -     
  -    }
  -    
  -    public void beanError(int messageNr) throws EJBException{
  -     // DO JMS - First transaction
  -     sendMessage(messageNr);
  -     PublisherCMPHome h = null;
  -     try {
  -         // DO entity bean - Second transaction
  -         h = (PublisherCMPHome) new InitialContext().lookup(BEAN_JNDI);
  -         PublisherCMP b = h.create(new Integer(messageNr));
  -         b.error(messageNr);
  -     } catch(Exception ex) {
  -         throw new EJBException("Exception in erro: " + ex);
  -     }finally {
  -         try {
  -             h.remove(new Integer(messageNr));
  -         }catch(Exception ex) {
  -             ex.printStackTrace();
  -         }
  -     }
  +    public void simpleFail(int messageNr)  {
  +    sendMessage(messageNr);
  +    // Roll it back, no message should be sent if transactins work
  +    System.err.println("DEBUG: Setting rollbackOnly");
  +    ctx.setRollbackOnly();
  +    System.err.println("DEBUG rollback set: " + ctx.getRollbackOnly());
  +    
       }
  +
  +    public void beanOk(int messageNr) {
  +    // DO JMS - First transaction
  +    sendMessage(messageNr);
  +    PublisherCMPHome h = null;
  +    try {
  +        // DO entity bean - Second transaction
  +        h = (PublisherCMPHome) new InitialContext().lookup(BEAN_JNDI);
  +        PublisherCMP b = h.create(new Integer(messageNr));
  +        b.ok(messageNr);
  +    }catch(Exception ex) {
  +        throw new EJBException("OPS exception in ok: " + ex);
  +    } finally {
  +        try {
  +        h.remove(new Integer(messageNr));
  +        }catch(Exception e) {
  +        e.printStackTrace();
  +        }
  +    }
       
  +    }
  +
  +    public void beanError(int messageNr) {
  +    // DO JMS - First transaction
  +    sendMessage(messageNr);
  +    PublisherCMPHome h = null;
  +    try {
  +        // DO entity bean - Second transaction
  +        h = (PublisherCMPHome) new InitialContext().lookup(BEAN_JNDI);
  +        PublisherCMP b = h.create(new Integer(messageNr));
  +        b.error(messageNr);
  +    } catch(Exception ex) {
  +        throw new EJBException("Exception in erro: " + ex);
  +    }finally {
  +        try {
  +        h.remove(new Integer(messageNr));
  +        }catch(Exception ex) {
  +        ex.printStackTrace();
  +        }
  +    }
  +    }
  +
       public void ejbRemove() throws RemoteException {
           if(queueConnection != null) {
               try {
  @@ -114,27 +114,27 @@
       public void ejbActivate() {}
       public void ejbPassivate() {}
   
  -    private void sendMessage(int messageNr) throws EJBException{
  -     QueueSession   queueSession = null;
  -     try {
  -         QueueSender queueSender = null;
  -         TextMessage    message = null;
  -         
  -            queueSession = 
  +    private void sendMessage(int messageNr) {
  +    QueueSession   queueSession = null;
  +    try {
  +        QueueSender queueSender = null;
  +        TextMessage    message = null;
  +    
  +            queueSession =
                   queueConnection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
               queueSender = queueSession.createSender(queue);
  -         
  +    
               message = queueSession.createTextMessage();
  -         message.setText(String.valueOf(messageNr));
  -         message.setIntProperty(Publisher.JMS_MESSAGE_NR, messageNr);
  -         queueSender.send(message);
  -         
  -         
  +        message.setText(String.valueOf(messageNr));
  +        message.setIntProperty(Publisher.JMS_MESSAGE_NR, messageNr);
  +        queueSender.send(message);
  +    
  +    
           } catch (JMSException ex) {
  -         
  +    
               ex.printStackTrace();
               ctx.setRollbackOnly();
  -         throw new EJBException(ex.toString());
  +        throw new EJBException(ex.toString());
           } finally {
               if (queueSession != null) {
                   try {
  
  
  
  1.2       +18 -18    
jbosstest/src/main/org/jboss/test/jmsra/bean/PublisherCMPBean.java
  
  Index: PublisherCMPBean.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbosstest/src/main/org/jboss/test/jmsra/bean/PublisherCMPBean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PublisherCMPBean.java     2001/04/26 21:18:52     1.1
  +++ PublisherCMPBean.java     2001/05/19 23:13:11     1.2
  @@ -5,12 +5,12 @@
    * modify it under the terms of the GNU Lesser General Public
    * License as published by the Free Software Foundation; either
    * version 2 of the License, or (at your option) 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
  @@ -29,46 +29,46 @@
    *
    * Created: Tue Apr 24 22:32:41 2001
    *
  - * @author 
  + * @author
    * @version
    */
   
   public class PublisherCMPBean  extends EntitySupport {
       public Integer nr;
       public PublisherCMPBean() {
  -     
  +    
       }
       public Integer getNr()
      {
         return nr;
      }
  -    
  +
       public void setNr(Integer nr)
       {
  -     this.nr = nr;
  +    this.nr = nr;
       }
  -    
  -    public void ok(int nr)throws EJBException {
  -     // Do nothing
  +
  +    public void ok(int nr) {
  +    // Do nothing
       }
   
  -    public void error(int nr)throws EJBException {
  -     // Roll back throug an exception
  -     throw new EJBException("Roll back!");
  +    public void error(int nr) {
  +    // Roll back throug an exception
  +    throw new EJBException("Roll back!");
       }
       // EntityBean implementation -------------------------------------
  -   public Integer ejbCreate(Integer nr) 
  +   public Integer ejbCreate(Integer nr)
         throws CreateException
  -   { 
  +   {
          this.nr = nr;
         return null;
      }
  -   
  -   public void ejbPostCreate(Integer nr) 
  +
  +   public void ejbPostCreate(Integer nr)
         throws CreateException
  -   { 
  +   {
      }
  -   
  +
      public void ejbLoad()
      {
      }
  
  
  
  1.2       +74 -74    
jbosstest/src/main/org/jboss/test/jmsra/bean/TopicPublisherBean.java
  
  Index: TopicPublisherBean.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbosstest/src/main/org/jboss/test/jmsra/bean/TopicPublisherBean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TopicPublisherBean.java   2001/04/26 21:18:52     1.1
  +++ TopicPublisherBean.java   2001/05/19 23:13:11     1.2
  @@ -1,6 +1,6 @@
   package org.jboss.test.jmsra.bean;
   
  -import java.rmi.RemoteException; 
  +import java.rmi.RemoteException;
   import java.util.*;
   import javax.ejb.SessionBean;
   import javax.ejb.SessionContext;
  @@ -10,12 +10,12 @@
   
   
   public class TopicPublisherBean implements SessionBean {
  -    
  +
       private static final String CONNECTION_JNDI = 
"java:comp/env/jms/MyTopicConnection";
       private static final String TOPIC_JNDI = "java:comp/env/jms/TopicName";
   
       private static final String BEAN_JNDI = "java:comp/env/ejb/PublisherCMP";
  -  
  +
       private SessionContext ctx = null;
       private Topic topic = null;
       private TopicConnection topicConnection = null;
  @@ -26,81 +26,81 @@
           this.ctx = ctx;
       }
   
  -    public void ejbCreate() throws EJBException {
  +    public void ejbCreate()  {
           try {
               Context context = new InitialContext();
               topic = (Topic)context.lookup(TOPIC_JNDI);
  -         
  -         TopicConnectionFactory factory = 
(TopicConnectionFactory)context.lookup(CONNECTION_JNDI);       
  -         topicConnection = factory.createTopicConnection();
  -         
  +    
  +        TopicConnectionFactory factory = 
(TopicConnectionFactory)context.lookup(CONNECTION_JNDI);   
  +        topicConnection = factory.createTopicConnection();
  +    
           } catch (Exception ex) {
               // JMSException or NamingException could be thrown
               ex.printStackTrace();
  -         throw new EJBException(ex.toString());
  +        throw new EJBException(ex.toString());
           }
       }
   
       /**
        * Send a message with a message nr in property MESSAGE_NR
        */
  -    public void simple(int messageNr) throws EJBException {
  -     sendMessage(messageNr);
  +    public void simple(int messageNr)  {
  +    sendMessage(messageNr);
       }
       /**
        * Try send a message with a message nr in property MESSAGE_NR,
        * but set rollback only
        */
  -    public void simpleFail(int messageNr) throws EJBException {
  -     sendMessage(messageNr);
  -     // Roll it back, no message should be sent if transactins work
  -     System.err.println("DEBUG: Setting rollbackOnly");
  -     ctx.setRollbackOnly();
  -     System.err.println("DEBUG rollback set: " + ctx.getRollbackOnly()); 
  -     
  -    }
  -
  -    public void beanOk(int messageNr) throws EJBException{
  -     // DO JMS - First transaction
  -     sendMessage(messageNr);
  -     PublisherCMPHome h = null;
  -     try {
  -         // DO entity bean - Second transaction
  -         h = (PublisherCMPHome) new InitialContext().lookup(BEAN_JNDI);
  -         PublisherCMP b = h.create(new Integer(messageNr));
  -         b.ok(messageNr);
  -     }catch(Exception ex) {
  -         throw new EJBException("OPS exception in ok: " + ex);
  -     } finally {
  -         try {
  -             h.remove(new Integer(messageNr));
  -         }catch(Exception e) {
  -             e.printStackTrace();
  -         }
  -     }
  -     
  -    }
  -    
  -    public void beanError(int messageNr) throws EJBException{
  -     // DO JMS - First transaction
  -     sendMessage(messageNr);
  -     PublisherCMPHome h = null;
  -     try {
  -         // DO entity bean - Second transaction
  -         h = (PublisherCMPHome) new InitialContext().lookup(BEAN_JNDI);
  -         PublisherCMP b = h.create(new Integer(messageNr));
  -         b.error(messageNr);
  -     } catch(Exception ex) {
  -         throw new EJBException("Exception in erro: " + ex);
  -     }finally {
  -         try {
  -             h.remove(new Integer(messageNr));
  -         }catch(Exception ex) {
  -             ex.printStackTrace();
  -         }
  -     }
  +    public void simpleFail(int messageNr)  {
  +    sendMessage(messageNr);
  +    // Roll it back, no message should be sent if transactins work
  +    System.err.println("DEBUG: Setting rollbackOnly");
  +    ctx.setRollbackOnly();
  +    System.err.println("DEBUG rollback set: " + ctx.getRollbackOnly());
  +    
       }
  +
  +    public void beanOk(int messageNr) {
  +    // DO JMS - First transaction
  +    sendMessage(messageNr);
  +    PublisherCMPHome h = null;
  +    try {
  +        // DO entity bean - Second transaction
  +        h = (PublisherCMPHome) new InitialContext().lookup(BEAN_JNDI);
  +        PublisherCMP b = h.create(new Integer(messageNr));
  +        b.ok(messageNr);
  +    }catch(Exception ex) {
  +        throw new EJBException("OPS exception in ok: " + ex);
  +    } finally {
  +        try {
  +        h.remove(new Integer(messageNr));
  +        }catch(Exception e) {
  +        e.printStackTrace();
  +        }
  +    }
       
  +    }
  +
  +    public void beanError(int messageNr) {
  +    // DO JMS - First transaction
  +    sendMessage(messageNr);
  +    PublisherCMPHome h = null;
  +    try {
  +        // DO entity bean - Second transaction
  +        h = (PublisherCMPHome) new InitialContext().lookup(BEAN_JNDI);
  +        PublisherCMP b = h.create(new Integer(messageNr));
  +        b.error(messageNr);
  +    } catch(Exception ex) {
  +        throw new EJBException("Exception in erro: " + ex);
  +    }finally {
  +        try {
  +        h.remove(new Integer(messageNr));
  +        }catch(Exception ex) {
  +        ex.printStackTrace();
  +        }
  +    }
  +    }
  +
       public void ejbRemove() throws RemoteException {
           if(topicConnection != null) {
               try {
  @@ -114,27 +114,27 @@
       public void ejbActivate() {}
       public void ejbPassivate() {}
   
  -    private void sendMessage(int messageNr) throws EJBException{
  -     TopicSession   topicSession = null;
  -     try {
  -         TopicPublisher topicPublisher = null;
  -         TextMessage    message = null;
  -         
  -            topicSession = 
  +    private void sendMessage(int messageNr) {
  +    TopicSession   topicSession = null;
  +    try {
  +        TopicPublisher topicPublisher = null;
  +        TextMessage    message = null;
  +    
  +            topicSession =
                   topicConnection.createTopicSession(true, Session.AUTO_ACKNOWLEDGE);
               topicPublisher = topicSession.createPublisher(topic);
  -         
  +    
               message = topicSession.createTextMessage();
  -         message.setText(String.valueOf(messageNr));
  -         message.setIntProperty(Publisher.JMS_MESSAGE_NR, messageNr);
  -         topicPublisher.publish(message);
  -         
  -         
  +        message.setText(String.valueOf(messageNr));
  +        message.setIntProperty(Publisher.JMS_MESSAGE_NR, messageNr);
  +        topicPublisher.publish(message);
  +    
  +    
           } catch (JMSException ex) {
  -         
  +    
               ex.printStackTrace();
               ctx.setRollbackOnly();
  -         throw new EJBException(ex.toString());
  +        throw new EJBException(ex.toString());
           } finally {
               if (topicSession != null) {
                   try {
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to