/*
 * 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;

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

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