// Path: src/main/java/com/blazemeter/jmeter/debugger/elements/OriginalLink.java
// public interface OriginalLink<T> {
//     T getOriginal();
// 
//     void setOriginal(T orig);
// }
// 
// Path: src/main/java/com/blazemeter/jmeter/debugger/elements/TimerDebug.java
// public class TimerDebug extends AbstractDebugElement<Timer> implements Timer {
//     private static final Logger log = LoggerFactory.getLogger(TimerDebug.class);
// 
// 
// 
//     private boolean isDelaying = false;
// 
//     @Override
//     public long delay() {
//         prepareBean();
//         getHook().stepOn(this);
//         long delay = wrapped.delay();
//         if (isDelaying) {
//             return delay;
//         } else {
//             log.debug("Drop delay because of debug: " + delay);
//             return 0;
//         }
//     }
// 
//     public void setDelaying(boolean delaying) {
//         isDelaying = delaying;
//     }
// }
// 
// Path: src/main/java/com/blazemeter/jmeter/debugger/elements/Wrapper.java
// public interface Wrapper<T> extends TestElement {
//     T getWrappedElement();
// 
//     void setWrappedElement(T wrapped);
// }
// 
// Path: src/main/java/org/apache/jmeter/threads/JMeterContextServiceAccessor.java
// public class JMeterContextServiceAccessor {
// 
//     public static void removeContext() {
//         JMeterContextService.removeContext();
//     }
// }


import com.blazemeter.jmeter.debugger.elements.OriginalLink;
import com.blazemeter.jmeter.debugger.elements.TimerDebug;
import com.blazemeter.jmeter.debugger.elements.Wrapper;
import org.apache.jmeter.JMeter;
import org.apache.jmeter.engine.JMeterEngineException;
import org.apache.jmeter.engine.StandardJMeterEngine;
import org.apache.jmeter.gui.GuiPackage;
import org.apache.jmeter.gui.tree.JMeterTreeNode;
import org.apache.jmeter.samplers.Sampler;
import org.apache.jmeter.testelement.TestElement;
import org.apache.jmeter.testelement.TestStateListener;
import org.apache.jmeter.threads.AbstractThreadGroup;
import org.apache.jmeter.threads.JMeterContext;
import org.apache.jmeter.threads.JMeterContextService;
import org.apache.jmeter.threads.JMeterContextServiceAccessor;
import org.apache.jorphan.collections.HashTree;
import org.apache.jorphan.util.JMeterStopThreadException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
        engine.configure(hashTree);
        try {
            engine.runTest();
        } catch (JMeterEngineException e) {
            log.error("Failed to pauseContinue debug", e);
            stop();
        }
    }

    public void stop() {
        log.debug("Stop debugging");

        if (stopping) {
            throw new IllegalStateException("Already stopping");
        }

        stopping = true;
        try {
            if (engine != null && engine.isActive()) {
                engine.stopTest(true);
            }
        } finally {
            stopping = false;
            frontend.stopped();
            JMeterContextServiceAccessor.removeContext();
            currentElement = null;
        }
    }

    @Override
// Path: src/main/java/com/blazemeter/jmeter/debugger/elements/OriginalLink.java
// public interface OriginalLink<T> {
//     T getOriginal();
// 
//     void setOriginal(T orig);
// }
// 
// Path: src/main/java/com/blazemeter/jmeter/debugger/elements/TimerDebug.java
// public class TimerDebug extends AbstractDebugElement<Timer> implements Timer {
//     private static final Logger log = LoggerFactory.getLogger(TimerDebug.class);
// 
// 
// 
//     private boolean isDelaying = false;
// 
//     @Override
//     public long delay() {
//         prepareBean();
//         getHook().stepOn(this);
//         long delay = wrapped.delay();
//         if (isDelaying) {
//             return delay;
//         } else {
//             log.debug("Drop delay because of debug: " + delay);
//             return 0;
//         }
//     }
// 
//     public void setDelaying(boolean delaying) {
//         isDelaying = delaying;
//     }
// }
// 
// Path: src/main/java/com/blazemeter/jmeter/debugger/elements/Wrapper.java
// public interface Wrapper<T> extends TestElement {
//     T getWrappedElement();
// 
//     void setWrappedElement(T wrapped);
// }
// 
// Path: src/main/java/org/apache/jmeter/threads/JMeterContextServiceAccessor.java
// public class JMeterContextServiceAccessor {
// 
//     public static void removeContext() {
//         JMeterContextService.removeContext();
//     }
// }


// Path: src/main/java/com/blazemeter/jmeter/debugger/engine/Debugger.java
import com.blazemeter.jmeter.debugger.elements.OriginalLink;
import com.blazemeter.jmeter.debugger.elements.TimerDebug;
import com.blazemeter.jmeter.debugger.elements.Wrapper;
import org.apache.jmeter.JMeter;
import org.apache.jmeter.engine.JMeterEngineException;
import org.apache.jmeter.engine.StandardJMeterEngine;
import org.apache.jmeter.gui.GuiPackage;
import org.apache.jmeter.gui.tree.JMeterTreeNode;
import org.apache.jmeter.samplers.Sampler;
import org.apache.jmeter.testelement.TestElement;
import org.apache.jmeter.testelement.TestStateListener;
import org.apache.jmeter.threads.AbstractThreadGroup;
import org.apache.jmeter.threads.JMeterContext;
import org.apache.jmeter.threads.JMeterContextService;
import org.apache.jmeter.threads.JMeterContextServiceAccessor;
import org.apache.jorphan.collections.HashTree;
import org.apache.jorphan.util.JMeterStopThreadException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

        engine.configure(hashTree);
        try {
            engine.runTest();
        } catch (JMeterEngineException e) {
            log.error("Failed to pauseContinue debug", e);
            stop();
        }
    }

    public void stop() {
        log.debug("Stop debugging");

        if (stopping) {
            throw new IllegalStateException("Already stopping");
        }

        stopping = true;
        try {
            if (engine != null && engine.isActive()) {
                engine.stopTest(true);
            }
        } finally {
            stopping = false;
            frontend.stopped();
            JMeterContextServiceAccessor.removeContext();
            currentElement = null;
        }
    }

    @Override
    public synchronized void stepOn(Wrapper wrapper) {