StandardJMeterEngine jm = new StandardJMeterEngine(); hashTree.add("httpSampler", httpSampler); jm.configure(hashTree); jm.run();
public static void stopEngine() { if (engine != null) { // May be null if called from Unit test engine.stopTest(false); } }
/** * {@inheritDoc} */ @Override public final void addNode(Object node, HashTree subTree) { node = addNodeToTree(node); addLast(node); }
FileInputStream in = new FileInputStream(testPlanPath); HashTree testPlanTree = SaveService.loadTree(in); in.close(); StandardJMeterEngine jmeter = new StandardJMeterEngine(); jmeter.configure(testPlanTree); jmeter.runTest();
private ListedHashTree cloneTree(ListedHashTree tree) { TreeCloner cloner = new TreeCloner(true); tree.traverse(cloner); return cloner.getClonedTree(); } }
public static void startServer(int rmiRegistryPort) throws RemoteException { RemoteJMeterEngineImpl engine = new RemoteJMeterEngineImpl( RmiUtils.DEFAULT_LOCAL_PORT, rmiRegistryPort); engine.init(); }
@Override public void rrunTest() throws RemoteException, JMeterEngineException { log.info("Running test"); checkOwner("runTest"); backingEngine.runTest(); }
@Override public void rreset() throws RemoteException { // Mail on userlist reported NPE here - looks like only happens if there are network errors, but check anyway if (backingEngine != null) { log.info("Reset"); checkOwner("reset"); backingEngine.reset(); } else { log.warn("Backing engine is null, ignoring reset"); } }
/** {@inheritDoc} */ @Override public void reset() { try { try { remote.rreset(); } catch (java.rmi.ConnectException e) { log.info("Retry reset after: "+e); remote = getEngine(hostAndPort); remote.rreset(); } } catch (Exception ex) { log.error("Failed to reset remote engine", ex); // $NON-NLS-1$ } }
/** * * @param now boolean that tell wether stop is immediate (interrupt) or not (wait for current sample end) */ void stopTest(boolean now);
public static boolean stopThread(String threadName) { return stopThread(threadName, false); }
public StandardJMeterEngine(String host) { this.host = host; // Hack to allow external control initSingletonEngine(this); } /**
/** * A factory method that might be overridden for unit testing * * @param address address for engine * @return engine instance * @throws RemoteException if registry can't be contacted * @throws NotBoundException when name for address can't be found */ protected JMeterEngine createEngine(String address) throws RemoteException, NotBoundException { return new ClientJMeterEngine(address); }
public ClientJMeterEngine(String hostAndPort) throws NotBoundException, RemoteException { this.remote = getEngine(hostAndPort); this.hostAndPort = hostAndPort; }
public static void stopEngineNow() { if (engine != null) {// May be null if called from Unit test engine.stopTest(true); } }
@Override public void rstopTest(boolean now) throws RemoteException { if (now) { log.info("Stopping test ..."); } else { log.info("Shutting test ..."); } backingEngine.stopTest(now); log.info("... stopped"); }
public static boolean stopThreadNow(String threadName) { return stopThread(threadName, true); }
@Override public void reset() { if (running) { stopTest(); } }
/** * Stop Test Now */ @Override public synchronized void stopTest() { stopTest(true); }
/** * Clean shutdown ie, wait for end of current running samplers */ public void askThreadsToStop() { if (engine != null) { // Will be null if StopTest thread has started engine.stopTest(false); } }