@Override public int startThread(final Object testRunner) throws InvalidContextException { throw new InvalidContextException("You should not start worker threads until the main thread has " + "initialised the script engine, or after all other threads have " + "shut down. Typically, you should only call startWorkerThread() " + "from another worker thread."); } }
private StatisticsSet getStatisticsChecked() throws InvalidContextException { if (m_statistics == null) { throw new InvalidContextException( "Statistics for test invocation have been reported and cannot be " + "updated. Perhaps you should have called setDelayReports(true)?"); } return m_statistics; }
@Override public int startThread(final Object testRunner) throws InvalidContextException { throw new InvalidContextException( "You should not start worker threads until the main thread has " + "initialised the script engine, or after all other threads have " + "shut down. Typically, you should only call startWorkerThread() " + "from another worker thread."); } }
private ThreadContext getThreadContext() throws InvalidContextException { final ThreadContext threadContext = m_threadContextLocator.get(); if (threadContext == null) { throw new InvalidContextException( "Statistics interface is only supported for worker threads."); } return threadContext; }
public void setKeyStoreFile(String keyStoreFileName, String password, String keyStoreType) throws GeneralSecurityException, InvalidContextException, IOException { final ThreadContext threadContext = m_threadContextLocator.get(); if (threadContext == null) { throw new InvalidContextException( "setKeyStoreFile is only supported for worker threads."); } final FileInputStream fileInputStream = new FileInputStream(keyStoreFileName); try { setKeyStore(fileInputStream, password, keyStoreType); } finally { fileInputStream.close(); } }
public StatisticsForTest getForLastTest() throws InvalidContextException { final StatisticsForTest statisticsForLastTest = getThreadContext().getStatisticsForLastTest(); if (statisticsForLastTest == null) { throw new InvalidContextException( "No tests have been performed by this thread."); } return statisticsForLastTest; } }
public void stopThisWorkerThread() throws InvalidContextException { if (m_threadContextLocator.get() != null) { throw new ShutdownException("Thread has been shut down"); } else { throw new InvalidContextException( "stopThisWorkerThread() must be called from a worker thread"); } }
public StatisticsForTest getForCurrentTest() throws InvalidContextException { final StatisticsForTest statisticsForCurrentTest = getThreadContext().getStatisticsForCurrentTest(); if (statisticsForCurrentTest == null) { throw new InvalidContextException("There is no test in progress."); } return statisticsForCurrentTest; }
public void setKeyStore(final InputStream keyStoreInputStream, final String password, String keyStoreType) throws GeneralSecurityException, InvalidContextException, IOException { final ThreadContext threadContext = m_threadContextLocator.get(); if (threadContext == null) { throw new InvalidContextException( "setKeyStore is only supported for worker threads."); } final char[] passwordChars = password != null ? password.toCharArray() : null; setThreadSSLContextFactory( threadContext, new CachingSSLContextFactory( new InsecureSSLContextFactory(keyStoreInputStream, passwordChars, keyStoreType))); }
public void setKeyManagers(final KeyManager[] keyManagers) throws InvalidContextException { final ThreadContext threadContext = m_threadContextLocator.get(); if (threadContext == null) { throw new InvalidContextException( "setKeyManagers is only supported for worker threads."); } setThreadSSLContextFactory(threadContext, new CachingSSLContextFactory( new InsecureSSLContextFactory(keyManagers))); }
public void registerDataLogExpression(String displayName, String expression) throws GrinderException { if (m_threadContextLocator.get() != null) { throw new InvalidContextException( "registerDataLogExpression() is not supported from worker threads"); } m_statisticsServices.getDetailStatisticsView().add( StatisticsServicesImplementation.getInstance() .getStatisticExpressionFactory() .createExpressionView(displayName, expression, false)); }