SingleConsole extends AbstractSingleConsole implements Listener, SampleListener, AcceptDistFilesDigestListener { public boolean isCurrentRunningTimeOverDuration(long duration) { return getCurrentRunningTime() > (duration); } SingleConsole(int port);  SingleConsole(String ip, int port, ConsoleCommunicationSetting consoleCommunicationSetting,
						 ConsoleProperties consoleProperties); int getConsolePort(); void start(); void shutdown(); int getAllAttachedAgentsCount(); List<AgentIdentity> getAllAttachedAgents(); T getConsoleComponent(Class<T> componentType); ConsoleProperties getConsoleProperties(); long startTest(GrinderProperties properties); void setDistributionDirectory(File filePath); @Override void cancel(); void distributeFiles(File filePath, ListenerSupport<FileDistributionListener> listener, boolean safe); String getConsoleIP(); @Override void onAcceptDistFilesDigestListener(Set<String> distFilesDigest); void sendDistFilesDigestToAgents(Set<String> distFilesDigest); void distributeFiles(ListenerSupport<FileDistributionListener> listener, final boolean safe); void waitUntilAgentPrepared(int size); void waitUntilAllAgentDisconnected(); boolean isAllTestFinished(); void setTpsValue(double newValue); double getTpsValues(); @Override long getCurrentRunningTime(); StatisticsIndexMap getStatisticsIndexMap(); ExpressionView[] getExpressionView(); Set<Entry<String, StatisticExpression>> getExpressionEntrySet(); @Override void update(final StatisticsSet intervalStatistics, final StatisticsSet cumulativeStatistics); void writeIntervalSummaryData(StatisticsSet intervalStatistics, boolean firstCall); void writeIntervalCsvData(StatisticsSet intervalStatistics); static boolean isPerfTestInterestingStatistics(String key); static boolean isInterestingStatistics(String key); @Override long getCurrentExecutionCount(); ListenerSupport<ConsoleShutdownListener> getListeners(); void addListener(ConsoleShutdownListener listener); void addSamplingLifeCycleListener(SamplingLifeCycleListener listener); @Override void update(ProcessReports[] processReports); Map<String, Object> getStatisticsData(); @Override File getReportPath(); void setReportPath(File reportPath); void sendStopMessageToAgents(); void startSampling(); void unregisterSampling(); GrinderProperties getGrinderProperties(); boolean hasTooManyError(); boolean hasNoPerformedTest(); boolean isCanceled(); boolean isCurrentRunningTimeOverDuration(long duration); @Override double getPeakTpsForGraph(); SampleModelImplementationEx getSampleModel(); void setSampleModel(SampleModel sampleModel); @Override int getRunningThread(); @Override int getRunningProcess(); List<Set<String>> getAgentCachedDistFilesDigestList(); @SuppressWarnings("UnusedDeclaration") void addSamplingLifeCycleFollowUpCycleListener(SamplingLifeCycleFollowUpListener listener); void setCsvSeparator(String csvSeparator); static final Resources RESOURCE; static final Logger LOGGER; static final String REPORT_DATA; static final int MIN_SAMPLING_INTERVAL_TO_ACTIVATE_TPS_PER_TEST; }
@Test public void testCurrentRunningTimeOverDuration() { SingleConsole singleConsole = new SingleConsole(getFreePort()) { public long getCurrentRunningTime() { return new Date().getTime() - current.getTime(); } }; ThreadUtils.sleep(200); assertThat(singleConsole.isCurrentRunningTimeOverDuration(1000), is(false)); ThreadUtils.sleep(800); assertThat(singleConsole.isCurrentRunningTimeOverDuration(1000), is(true)); }