/*
 * JBoss, the OpenSource J2EE webOS
 * 
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package org.jboss.test.messagedriven.support;

import javax.management.ObjectName;

/**
 * Stop delivery
 *
 * @author <a href="mailto:adrian@jboss.com>Adrian Brock</a>
 * @version <tt>$Revision: 1.4</tt>
 */
public class DeactivateOperation extends Operation
{
   protected ObjectName mdbInvoker;
   
   public DeactivateOperation(BasicMessageDrivenUnitTest test, ObjectName mdbInvoker)
   {
      super(test);
      this.mdbInvoker = mdbInvoker;
   }

   public void run() throws Exception
   {
      test.deactivate(mdbInvoker);
      if (Boolean.TRUE.equals(test.getAttribute(mdbInvoker, "DeliveryActive")))
         throw new Exception("Failed to deactivate: " + mdbInvoker);
   }
}
