From 31187b6eed2dcd75bf340f8f2f0b06bae74bdf3f Mon Sep 17 00:00:00 2001 From: Kevin McGoldrick Date: Wed, 15 Sep 2021 15:00:37 -0700 Subject: [PATCH] Release 3.1.0 * JSF 2.3 * Remove PicketLink/DeltaSpike * Add AdminFilter * Obfuscate password in LogEvents * Bump commons-compress from 1.20 to 1.21 * Filter Page: Fix Search Bar Bug * Fix: Filter search listener to TableState Filter Function * Fix "New Project" navigation button * Proxy Recorder: Process 302 Transactions * Fix User Delete * SRE-19012 Stop gui spinner from spinning * Add env to logging variables [SRE-19083] * Fix Sort on Filter Apply Page * Fix apiharness local execution * Remove redundant file exists check * disable delete button during tests [SRE-19307] * SRE-19307 implement isDeletable() * Unblock thread start processes * Refactor Method Names [SRE-19325] * TestPlanStarter Unit Tests * Stop creating threads after ramp for loop completion use case. * stop thread starter after ramp (scripts loops completed) * Implement StopBehavior [SRE-19391] Co-authored-by: Shawn Park <88464473+shawn-h-park@users.noreply.github.com> Co-authored-by: Bryan Alexander Rivera <2250179+bryaan@users.noreply.github.com> Co-authored-by: Bryan Rivera --- .travis.yml | 5 +- agent/agent_common/pom.xml | 2 +- .../intuit/tank/http/json/JsonRequest.java | 8 +- .../tank/http/json/PlainTextRequest.java | 2 +- agent/agent_standalone/pom.xml | 2 +- agent/agent_standalone_pkg/pom.xml | 2 +- agent/agent_startup/pom.xml | 2 +- agent/agent_startup_pkg/pom.xml | 2 +- agent/apiharness/pom.xml | 2 +- .../intuit/tank/harness/APITestHarness.java | 36 ++-- .../com/intuit/tank/harness/AgentRunData.java | 16 +- .../com/intuit/tank/harness/AgentUtil.java | 23 +-- .../tank/harness/TestPlanSingleton.java | 16 +- .../intuit/tank/harness/TestPlanStarter.java | 34 ++-- .../harness/functions/JexlIOFunctions.java | 2 +- .../functions/JexlNumericFunctions.java | 2 +- .../functions/JexlStringFunctions.java | 2 +- .../intuit/tank/harness/logging/LogEvent.java | 6 +- .../harness/logging/ThreadLocalLogEvent.java | 1 + .../tank/harness/test/data/DataItem.java | 2 +- .../harness/test/data/ValidationItem.java | 2 +- .../tank/harness/test/data/Variables.java | 2 +- .../intuit/tank/runner/TestPlanRunner.java | 34 ++-- .../method/AgentLoggingOutputLogger.java | 4 +- .../apiharness/src/main/resources/log4j2.xml | 1 + .../intuit/tank/harness/AgentRunDataTest.java | 134 +++++++------- .../intuit/tank/harness/AgentUtilTest.java | 27 ++- .../tank/harness/TestPlanStarterTest.java | 68 +++++++ .../tank/harness/logging/LogEventTest.java | 40 ++++ agent/apiharness_pkg/pom.xml | 2 +- agent/http_client_3/pom.xml | 2 +- agent/http_client_4/pom.xml | 2 +- agent/http_client_5/pom.xml | 2 +- agent/pom.xml | 2 +- all-in-one.sh | 4 +- api/pom.xml | 2 +- .../vm/agent/messages/AgentAvailability.java | 4 +- .../tank/vm/agent/messages/AgentData.java | 4 +- .../agent/messages/AgentMngrAPIRequest.java | 2 +- .../agent/messages/AgentMngrAPIResponse.java | 2 +- .../vm/agent/messages/AgentTestStartData.java | 2 +- .../messages/StandaloneAgentRequest.java | 6 +- .../agent/messages/WatsAgentStartRequest.java | 2 +- .../tank/vm/api/enumerated/VMRegion.java | 2 +- .../tank/vm/common/util/JSONBuilder.java | 4 +- .../tank/vm/common/util/MessageObject.java | 2 +- .../com/intuit/tank/vm/event/JobEvent.java | 2 +- .../tank/vm/event/NotificationContext.java | 2 +- .../tank/vm/exception/WatsParseException.java | 2 +- .../intuit/tank/vm/settings/DefaultUser.java | 6 +- .../intuit/tank/vm/settings/MailMessage.java | 2 +- .../tank/vm/settings/ReportingInstance.java | 2 +- .../tank/vm/settings/SelectableItem.java | 2 +- .../tank/vm/vmManager/JobRequestImpl.java | 34 ++-- .../tank/vm/vmManager/VMInformation.java | 2 +- .../tank/vm/vmManager/VMInstanceRequest.java | 2 +- data_access/pom.xml | 2 +- .../java/com/intuit/tank/dao/DataFileDao.java | 2 +- .../java/com/intuit/tank/dao/ScriptDao.java | 10 +- data_model/pom.xml | 2 +- .../com/intuit/tank/project/BaseEntity.java | 2 +- .../tank/project/ColumnPreferences.java | 6 +- .../com/intuit/tank/project/DataFile.java | 8 +- .../intuit/tank/project/EntityVersion.java | 6 +- .../intuit/tank/project/ExternalScript.java | 8 +- .../java/com/intuit/tank/project/Group.java | 6 +- .../intuit/tank/project/JobConfiguration.java | 6 +- .../com/intuit/tank/project/JobInstance.java | 6 +- .../intuit/tank/project/JobNotification.java | 16 +- .../com/intuit/tank/project/JobQueue.java | 6 +- .../com/intuit/tank/project/JobRecipient.java | 14 +- .../com/intuit/tank/project/JobRegion.java | 10 +- .../intuit/tank/project/JobVMInstance.java | 6 +- .../com/intuit/tank/project/PeriodicData.java | 8 +- .../java/com/intuit/tank/project/Project.java | 6 +- .../com/intuit/tank/project/ProjectDTO.java | 2 +- .../tank/project/ProjectDescription.java | 6 +- .../com/intuit/tank/project/RequestData.java | 6 +- .../java/com/intuit/tank/project/Script.java | 8 +- .../com/intuit/tank/project/ScriptFilter.java | 8 +- .../tank/project/ScriptFilterAction.java | 6 +- .../tank/project/ScriptFilterCondition.java | 6 +- .../tank/project/ScriptFilterGroup.java | 8 +- .../com/intuit/tank/project/ScriptGroup.java | 6 +- .../intuit/tank/project/ScriptGroupStep.java | 6 +- .../com/intuit/tank/project/ScriptStep.java | 8 +- .../tank/project/SerializedScriptStep.java | 6 +- .../com/intuit/tank/project/SummaryData.java | 8 +- .../com/intuit/tank/project/TestPlan.java | 6 +- .../java/com/intuit/tank/project/User.java | 6 +- .../com/intuit/tank/project/VMInstance.java | 6 +- .../com/intuit/tank/project/Workload.java | 6 +- .../tank/util/CreateDateComparator.java | 2 +- .../tank/util/ModifiedDateComparator.java | 2 +- .../tank/util/CreateDateComparatorTest.java | 2 +- doc/doc_xslt/pom.xml | 2 +- doc/jdocbook_style/pom.xml | 2 +- doc/pom.xml | 2 +- doc/tank_installation_guide/pom.xml | 2 +- doc/tank_user_guide/pom.xml | 2 +- harness_data/pom.xml | 2 +- .../tank/harness/data/AuthenticationStep.java | 2 +- .../tank/harness/data/ClearCookiesStep.java | 2 +- .../intuit/tank/harness/data/CookieStep.java | 2 +- .../intuit/tank/harness/data/LogicStep.java | 2 +- .../intuit/tank/harness/data/RequestStep.java | 2 +- .../tank/harness/data/SleepTimeStep.java | 2 +- .../tank/harness/data/ThinkTimeStep.java | 2 +- .../intuit/tank/harness/data/TimerStep.java | 2 +- .../tank/harness/data/ValidationData.java | 2 +- .../tank/harness/data/VariableStep.java | 2 +- jacoco-report-aggregator/pom.xml | 66 +++---- mail/pom.xml | 2 +- .../java/com/intuit/tank/mail/TankMailer.java | 2 +- pom.xml | 74 ++++---- proxy-parent/WebConversation/pom.xml | 2 +- .../com/intuit/tank/conversation/Header.java | 2 +- .../com/intuit/tank/conversation/Request.java | 4 +- .../intuit/tank/conversation/Transaction.java | 2 +- .../util/WebConversationJaxbParseXML.java | 4 +- proxy-parent/owasp-proxy/pom.xml | 2 +- proxy-parent/pom.xml | 2 +- proxy-parent/proxy-extension/pom.xml | 2 +- .../com/intuit/tank/entity/Application.java | 39 ++-- .../com/intuit/tank/proxy/EmbeddedProxy.java | 2 +- .../main/java/com/intuit/tank/proxy/Main.java | 2 +- .../java/com/intuit/tank/proxy/ProxyApp.java | 6 +- .../config/CommonsProxyConfiguration.java | 16 +- .../config/ConfigInclusionExclusionRule.java | 6 +- .../proxy/config/FixedProxyConfiguration.java | 14 +- .../proxy/settings/ui/RuleTableModel.java | 4 +- .../tank/proxy/table/ShowHostsDialog.java | 4 +- .../proxy/table/TransactionTableModel.java | 4 +- .../intuit/tank/entity/ApplicationTest.java | 103 +++++++++++ proxy-parent/proxy_pkg/pom.xml | 2 +- readme.md | 2 +- reporting/api/pom.xml | 2 +- .../reporting/api/DummyResultsReader.java | 14 +- .../reporting/api/DummyResultsReporter.java | 6 +- .../intuit/tank/reporting/api/TPSInfo.java | 6 +- .../tank/reporting/databases/Attribute.java | 6 +- .../intuit/tank/reporting/databases/Item.java | 6 +- .../com/intuit/tank/results/TankResult.java | 2 +- reporting/db/pom.xml | 2 +- .../databases/AmazonDynamoDatabaseDocApi.java | 20 +- .../databases/MetricsCalculator.java | 2 +- .../reporting/db/DatabaseResultsReader.java | 6 +- .../reporting/db/DatabaseResultsReporter.java | 4 +- reporting/local/pom.xml | 2 +- reporting/pom.xml | 2 +- reporting/rest/pom.xml | 2 +- .../reporting/rest/RestResultsReporter.java | 4 +- rest/api/agent/pom.xml | 2 +- rest/api/automation/pom.xml | 2 +- .../v1/automation/ApplyFiltersRequest.java | 4 +- .../v1/automation/AutomationJobRegion.java | 6 +- .../v1/automation/AutomationRequest.java | 6 +- .../model/v1/automation/CreateJobRequest.java | 4 +- .../v1/automation/adapter/MapEntryType.java | 4 +- .../adapter/XmlGenericMapAdapter.java | 4 +- rest/api/cloud/pom.xml | 2 +- .../api/model/v1/cloud/CloudVmStatus.java | 6 +- .../v1/cloud/CloudVmStatusContainer.java | 2 +- .../tank/api/model/v1/cloud/UserDetail.java | 2 +- .../api/model/v1/cloud/ValidationStatus.java | 6 +- rest/api/datafile/pom.xml | 2 +- rest/api/filter/pom.xml | 2 +- .../api/model/v1/filter/FilterGroupTO.java | 2 +- .../tank/api/model/v1/filter/FilterTO.java | 2 +- rest/api/job/pom.xml | 2 +- .../intuit/tank/api/model/v1/job/JobTO.java | 2 +- rest/api/pom.xml | 2 +- rest/api/project/pom.xml | 2 +- rest/api/reporting/pom.xml | 2 +- rest/api/script/pom.xml | 2 +- .../api/model/v1/script/ExternalScriptTO.java | 2 +- .../tank/api/model/v1/script/ScriptTO.java | 36 ++-- rest/api/user/pom.xml | 2 +- rest/client/agent/pom.xml | 2 +- rest/client/automation/pom.xml | 2 +- .../automation/AutomationServiceClient.java | 4 +- rest/client/cloud/pom.xml | 2 +- .../com/intuit/tank/CloudServiceClient.java | 54 +++--- rest/client/common/pom.xml | 2 +- .../com/intuit/tank/rest/BaseRestClient.java | 2 +- rest/client/datafile/pom.xml | 2 +- .../client/v1/datafile/DataFileClient.java | 12 +- rest/client/filter/pom.xml | 2 +- rest/client/job/pom.xml | 2 +- .../api/client/v1/job/JobServiceClient.java | 4 +- rest/client/pom.xml | 2 +- rest/client/project/pom.xml | 2 +- .../v1/project/ProjectServiceClientV1.java | 2 +- rest/client/reporting/pom.xml | 2 +- rest/client/script/pom.xml | 2 +- .../client/v1/script/ScriptServiceClient.java | 24 +-- rest/client/user/pom.xml | 2 +- .../v1/project/UserServiceClientV1.java | 6 +- rest/pom.xml | 2 +- rest/service/agent/pom.xml | 2 +- .../service/impl/v1/agent/AgentServiceV1.java | 4 +- rest/service/automation/pom.xml | 2 +- .../v1/automation/AutomationServiceV1.java | 16 +- rest/service/cloud/pom.xml | 2 +- .../impl/v1/cloud/CloudController.java | 6 +- .../service/impl/v1/cloud/CloudServiceV1.java | 58 +++--- .../service/impl/v1/cloud/CostingCache.java | 4 +- .../service/impl/v1/cloud/JobController.java | 44 ++--- rest/service/common/pom.xml | 6 +- .../intuit/tank/service/util/AuthUtil.java | 110 ----------- rest/service/datafile/pom.xml | 2 +- .../impl/v1/datafile/DataFileServiceV1.java | 20 +- rest/service/filter/pom.xml | 2 +- .../impl/v1/filter/FilterServiceV1.java | 4 +- rest/service/job/pom.xml | 2 +- .../service/impl/v1/job/JobServiceV1.java | 6 +- rest/service/pom.xml | 2 +- rest/service/project/pom.xml | 2 +- .../impl/v1/project/ProjectServiceV1.java | 16 +- rest/service/reporting/pom.xml | 2 +- .../impl/v1/report/ReportServiceV1.java | 19 +- .../impl/v1/report/SummaryReportRunner.java | 2 +- rest/service/script/pom.xml | 2 +- .../impl/v1/script/ScriptServiceV1.java | 32 ++-- rest/service/user/pom.xml | 2 +- .../service/impl/v1/user/UserServiceV1.java | 8 +- script_processor/pom.xml | 2 +- .../intuit/tank/script/util/OwaspReader.java | 4 +- search/document_util/pom.xml | 2 +- search/lucene_indexer/pom.xml | 2 +- search/pom.xml | 2 +- search/script_search/pom.xml | 2 +- tank_common/pom.xml | 2 +- .../monitor/GlobalPercentCompleteMonitor.java | 8 +- .../scriptGenerator/ConverterUtil.java | 6 +- .../scriptGenerator/ConverterUtilTest.java | 4 +- tank_vmManager/pom.xml | 2 +- .../scheduleManager/ScheduleManagerImpl.java | 6 +- .../jms/AgentDispatcherImpl.java | 6 +- .../intuit/tank/vmManager/AgentWatchdog.java | 4 +- .../tank/vmManager/VMTerminatorImpl.java | 2 +- .../intuit/tank/vmManager/VMTrackerImpl.java | 16 +- .../vmManager/environment/VMChannelImpl.java | 8 +- .../environment/amazon/AmazonInstance.java | 10 +- test_support/pom.xml | 2 +- tools/agent_debugger/pom.xml | 2 +- .../tools/debugger/AgentDebuggerFrame.java | 2 +- .../tools/debugger/ConfiguredLanguage.java | 2 +- .../debugger/DebuggerFlowController.java | 10 +- .../tank/tools/debugger/SelectDialog.java | 4 +- tools/agent_debugger_pkg/pom.xml | 6 +- tools/jenkins_plugin/pom.xml | 2 +- tools/pom.xml | 2 +- tools/script_engine/pom.xml | 2 +- .../tools/script/LoggingOutputLogger.java | 4 +- .../tank/tools/script/NullOutputLogger.java | 4 +- .../tank/tools/script/StringOutputLogger.java | 4 +- tools/script_filter/pom.xml | 2 +- .../tank/tools/script/ConfiguredLanguage.java | 2 +- .../tank/tools/script/LanguageRenderer.java | 2 +- .../tank/tools/script/SelectDialog.java | 4 +- .../tools/script/TextAreaOutputLogger.java | 4 +- .../intuit/tank/tools/script/WindowUtil.java | 2 - tools/script_filter_pkg/pom.xml | 2 +- web/pom.xml | 2 +- web/web_support/pom.xml | 12 +- .../java/com/intuit/tank/LoginObserver.java | 5 +- .../java/com/intuit/tank/OwnerUtilBean.java | 12 +- .../java/com/intuit/tank/PreferencesBean.java | 2 +- .../java/com/intuit/tank/ProjectBean.java | 11 +- .../intuit/tank/ProjectDescriptionBean.java | 4 +- .../com/intuit/tank/PropertyComparer.java | 2 +- .../com/intuit/tank/admin/GroupAdmin.java | 2 - .../java/com/intuit/tank/admin/UserAdmin.java | 16 +- .../com/intuit/tank/admin/UserLoader.java | 2 +- .../com/intuit/tank/auth/AccountModify.java | 11 +- .../intuit/tank/auth/InternalSecurity.java | 85 --------- .../java/com/intuit/tank/auth/Security.java | 71 ++------ .../intuit/tank/auth/TankAuthenticator.java | 171 ++++++------------ .../intuit/tank/auth/TankIdentityStore.java | 59 ++++++ .../intuit/tank/auth/TankSecurityContext.java | 62 +++++++ .../java/com/intuit/tank/auth/TankUser.java | 13 +- .../java/com/intuit/tank/config/Admin.java | 37 ---- .../com/intuit/tank/config/AdminFilter.java | 51 ++++++ .../intuit/tank/config/DepricatedView.java | 37 ---- .../com/intuit/tank/config/LoginFilter.java | 15 +- .../java/com/intuit/tank/config/Owner.java | 37 ---- .../com/intuit/tank/config/TsLoggedIn.java | 35 ---- .../tank/converter/BaseEnumConverter.java | 4 +- .../tank/converter/CollectionConverter.java | 4 +- .../tank/converter/DataFileConverter.java | 4 +- .../intuit/tank/converter/DateConverter.java | 4 +- .../tank/converter/ReplaceModeConverter.java | 4 +- .../tank/converter/ScriptConverter.java | 4 +- .../converter/ScriptStepHolderConverter.java | 4 +- .../tank/converter/SearchModeConverter.java | 4 +- .../tank/converter/TimeDurationConverter.java | 4 +- .../tank/converter/TimeZoneConverter.java | 4 +- .../com/intuit/tank/filter/FilterBean.java | 6 +- .../intuit/tank/filter/FilterGroupBean.java | 8 +- .../tank/filter/FilterGroupCreationBean.java | 20 +- .../tank/filter/ScriptFilterCreationBean.java | 18 +- .../com/intuit/tank/job/ActJobNodeBean.java | 7 +- .../java/com/intuit/tank/job/JobNodeBean.java | 6 +- .../com/intuit/tank/job/JobStatusHelper.java | 4 + .../com/intuit/tank/job/ProjectNodeBean.java | 7 +- .../java/com/intuit/tank/job/VMNodeBean.java | 5 +- .../tank/notification/NotificationRunner.java | 2 +- .../tank/project/CreateProjectBean.java | 16 +- .../intuit/tank/project/DataFileBrowser.java | 6 +- .../intuit/tank/project/DataFileLoader.java | 2 +- .../intuit/tank/project/FileUploadBean.java | 13 +- .../intuit/tank/project/JobQueueManager.java | 2 +- .../tank/project/ProjectJobQueueManager.java | 2 +- .../intuit/tank/project/ProjectLoader.java | 2 +- .../intuit/tank/project/VariableEntry.java | 4 +- .../com/intuit/tank/report/JobReport.java | 4 +- .../com/intuit/tank/report/JobReportData.java | 4 +- .../com/intuit/tank/script/CopyBuffer.java | 3 +- .../com/intuit/tank/script/ScriptBean.java | 17 +- .../tank/script/ScriptCreationBean.java | 13 +- .../com/intuit/tank/script/ScriptEditor.java | 12 +- .../com/intuit/tank/script/ScriptLoader.java | 2 +- .../intuit/tank/script/TankXmlUploadBean.java | 13 +- .../tank/service/InitializeEnvironment.java | 10 - .../intuit/tank/util/RestSecurityFilter.java | 11 +- .../com/intuit/tank/util/UserNameFilter.java | 63 ------- .../intuit/tank/wrapper/SelectableBean.java | 10 +- .../tank/auth/InternalSecurityTest.java | 162 ----------------- .../com/intuit/tank/auth/TankUserTest.java | 16 -- .../project/AssociateDataFileBeanTest.java | 8 - .../tank/project/CreateProjectBeanTest.java | 8 - .../intuit/tank/script/CopyBufferTest.java | 5 +- .../intuit/tank/script/ScriptBeanTest.java | 17 +- .../tank/script/ScriptCreationBeanTest.java | 6 - .../intuit/tank/script/ScriptEditorTest.java | 11 +- .../tank/script/ScriptSearchBeanTest.java | 7 - web/web_ui/pom.xml | 12 +- .../main/webapp/WEB-INF/templates/tank.xhtml | 4 +- web/web_ui/src/main/webapp/WEB-INF/web.xml | 27 +-- web/web_ui/src/main/webapp/agents/index.xhtml | 2 +- web/web_ui/src/main/webapp/expired.xhtml | 4 +- .../src/main/webapp/filters/index.xhtml | 6 +- web/web_ui/src/main/webapp/login.xhtml | 12 +- .../src/main/webapp/projects/index.xhtml | 7 +- .../webapp/projects/projectjobqueue.xhtml | 5 +- .../main/webapp/scripts/reapply-filters.xhtml | 4 +- 347 files changed, 1537 insertions(+), 1956 deletions(-) create mode 100644 agent/apiharness/src/test/java/com/intuit/tank/harness/TestPlanStarterTest.java create mode 100644 proxy-parent/proxy-extension/src/test/java/com/intuit/tank/entity/ApplicationTest.java delete mode 100644 rest/service/common/src/main/java/com/intuit/tank/service/util/AuthUtil.java delete mode 100644 web/web_support/src/main/java/com/intuit/tank/auth/InternalSecurity.java create mode 100644 web/web_support/src/main/java/com/intuit/tank/auth/TankIdentityStore.java create mode 100644 web/web_support/src/main/java/com/intuit/tank/auth/TankSecurityContext.java delete mode 100644 web/web_support/src/main/java/com/intuit/tank/config/Admin.java create mode 100644 web/web_support/src/main/java/com/intuit/tank/config/AdminFilter.java delete mode 100644 web/web_support/src/main/java/com/intuit/tank/config/DepricatedView.java delete mode 100644 web/web_support/src/main/java/com/intuit/tank/config/Owner.java delete mode 100644 web/web_support/src/main/java/com/intuit/tank/config/TsLoggedIn.java delete mode 100644 web/web_support/src/main/java/com/intuit/tank/util/UserNameFilter.java delete mode 100644 web/web_support/src/test/java/com/intuit/tank/auth/InternalSecurityTest.java diff --git a/.travis.yml b/.travis.yml index 2f086a83a..fddbf608a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,8 @@ jdk: - openjdk11 env: - - SKIP_METHODTIMER_TEST=true - - SKIP_GUI_TEST=true + global: + - SKIP_METHODTIMER_TEST=true + - SKIP_GUI_TEST=true script: mvn clean install -P default,coverage diff --git a/agent/agent_common/pom.xml b/agent/agent_common/pom.xml index 245210f6b..b1a172376 100644 --- a/agent/agent_common/pom.xml +++ b/agent/agent_common/pom.xml @@ -5,7 +5,7 @@ com.intuit.tank agent-parent - 3.0.2 + 3.1.0 agent-common diff --git a/agent/agent_common/src/main/java/com/intuit/tank/http/json/JsonRequest.java b/agent/agent_common/src/main/java/com/intuit/tank/http/json/JsonRequest.java index 1d305befe..78c6e103d 100644 --- a/agent/agent_common/src/main/java/com/intuit/tank/http/json/JsonRequest.java +++ b/agent/agent_common/src/main/java/com/intuit/tank/http/json/JsonRequest.java @@ -24,7 +24,7 @@ public JsonRequest(TankHttpClient client, TankHttpLogger logUtil) { /** * - * @inheritDoc + * {@inheritDoc} */ @Override public String getBody() { @@ -42,7 +42,7 @@ public String getBody() { /** * - * @inheritDoc + * {@inheritDoc} */ @Override public void setKey(String key, String value) { @@ -51,14 +51,14 @@ public void setKey(String key, String value) { /** * - * @inheritDoc + * {@inheritDoc} */ @Override public void setNamespace(String name, String value) { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public String getKey(String key) { diff --git a/agent/agent_common/src/main/java/com/intuit/tank/http/json/PlainTextRequest.java b/agent/agent_common/src/main/java/com/intuit/tank/http/json/PlainTextRequest.java index 3fef45a46..ff0229b11 100644 --- a/agent/agent_common/src/main/java/com/intuit/tank/http/json/PlainTextRequest.java +++ b/agent/agent_common/src/main/java/com/intuit/tank/http/json/PlainTextRequest.java @@ -15,7 +15,7 @@ public PlainTextRequest(TankHttpClient client, TankHttpLogger logUtil) { /** * - * @inheritDoc + * {@inheritDoc} */ @Override public String getBody() { diff --git a/agent/agent_standalone/pom.xml b/agent/agent_standalone/pom.xml index ddb53dc1a..1d1545db5 100755 --- a/agent/agent_standalone/pom.xml +++ b/agent/agent_standalone/pom.xml @@ -5,7 +5,7 @@ com.intuit.tank agent-parent - 3.0.2 + 3.1.0 agent-standalone diff --git a/agent/agent_standalone_pkg/pom.xml b/agent/agent_standalone_pkg/pom.xml index 2cb59a545..8a4688884 100755 --- a/agent/agent_standalone_pkg/pom.xml +++ b/agent/agent_standalone_pkg/pom.xml @@ -5,7 +5,7 @@ com.intuit.tank agent-parent - 3.0.2 + 3.1.0 agent-standalone-pkg diff --git a/agent/agent_startup/pom.xml b/agent/agent_startup/pom.xml index 95cc462d6..5f130b195 100755 --- a/agent/agent_startup/pom.xml +++ b/agent/agent_startup/pom.xml @@ -5,7 +5,7 @@ com.intuit.tank agent-parent - 3.0.2 + 3.1.0 agent-startup diff --git a/agent/agent_startup_pkg/pom.xml b/agent/agent_startup_pkg/pom.xml index d21423293..39a91776d 100755 --- a/agent/agent_startup_pkg/pom.xml +++ b/agent/agent_startup_pkg/pom.xml @@ -5,7 +5,7 @@ com.intuit.tank agent-parent - 3.0.2 + 3.1.0 agent-startup-pkg diff --git a/agent/apiharness/pom.xml b/agent/apiharness/pom.xml index dc1a11b8d..0453e59ee 100644 --- a/agent/apiharness/pom.xml +++ b/agent/apiharness/pom.xml @@ -5,7 +5,7 @@ com.intuit.tank agent-parent - 3.0.2 + 3.1.0 agent diff --git a/agent/apiharness/src/main/java/com/intuit/tank/harness/APITestHarness.java b/agent/apiharness/src/main/java/com/intuit/tank/harness/APITestHarness.java index 7b89ed5de..3c53806bb 100644 --- a/agent/apiharness/src/main/java/com/intuit/tank/harness/APITestHarness.java +++ b/agent/apiharness/src/main/java/com/intuit/tank/harness/APITestHarness.java @@ -103,7 +103,7 @@ public class APITestHarness { private TPSMonitor tpsMonitor; private ResultsReporter resultsReporter; private String tankHttpClientClass; - + private Date send = new Date(); private static final int interval = 15; // SECONDS @@ -160,10 +160,11 @@ private void initializeFromArgs(String[] args) { if (values[0].equalsIgnoreCase("-tp")) { testPlans = values[1]; if (!AgentUtil.validateTestPlans(testPlans)) { + usage(); return; } } else if (values[0].equalsIgnoreCase("-ramp")) { - agentRunData.setRampTime(Long.parseLong(values[1]) * 60000); + agentRunData.setRampTimeMillis(Long.parseLong(values[1]) * 60000); } else if (values[0].equalsIgnoreCase("-client")) { tankHttpClientClass = StringUtils.trim(values[1]); } else if (values[0].equalsIgnoreCase("-d")) { @@ -207,7 +208,7 @@ private void initializeFromArgs(String[] args) { } else if (values[0].equalsIgnoreCase("-http")) { controllerBase = (values.length > 1 ? values[1] : null); } else if (values[0].equalsIgnoreCase("-time")) { - agentRunData.setSimulationTime(Integer.parseInt(values[1]) * 60000); + agentRunData.setSimulationTimeMillis(Integer.parseInt(values[1]) * 60000); } } if (instanceId == null) { @@ -231,8 +232,7 @@ private void initializeFromArgs(String[] args) { startHttp(controllerBase); } else { resultsReporter = new DummyResultsReporter(); - TestPlanSingleton plans = TestPlanSingleton.getInstance(); - plans.setTestPlans(testPlans); + TestPlanSingleton.getInstance().setTestPlans(testPlans); runConcurrentTestPlans(); } } @@ -325,10 +325,10 @@ private void startHttp(String baseUrl) { agentRunData.setNumUsers(startData.getConcurrentUsers()); agentRunData.setNumStartUsers(startData.getStartUsers()); - agentRunData.setRampTime(startData.getRampTime()); + agentRunData.setRampTimeMillis(startData.getRampTime()); agentRunData.setJobId(startData.getJobId()); agentRunData.setUserInterval(startData.getUserIntervalIncrement()); - agentRunData.setSimulationTime(startData.getSimulationTime()); + agentRunData.setSimulationTimeMillis(startData.getSimulationTime()); agentRunData.setAgentInstanceNum(startData.getAgentInstanceNum()); agentRunData.setTotalAgents(startData.getTotalAgents()); @@ -483,10 +483,10 @@ public void runConcurrentTestPlans() { return; } tpsMonitor = new TPSMonitor(tankConfig.getAgentConfig().getTPSPeriod()); - String info = " RAMP_TIME=" + agentRunData.getRampTime() + + String info = " RAMP_TIME=" + agentRunData.getRampTimeMillis() + "; agentRunData.getNumUsers()=" + agentRunData.getNumUsers() + "; NUM_START_THREADS=" + agentRunData.getNumStartUsers() + - "; simulationTime=" + agentRunData.getSimulationTime(); + "; simulationTime=" + agentRunData.getSimulationTimeMillis(); LOG.info(new ObjectMessage(ImmutableMap.of("Message", "starting test with " + info))); started = true; @@ -511,7 +511,7 @@ public void runConcurrentTestPlans() { plan.setVariables(hdWorkload.getVariables()); ThreadGroup threadGroup = new ThreadGroup("Test Plan Runner Group"); threadGroupArray.add(threadGroup); - TestPlanStarter starter = new TestPlanStarter(httpClient, plan, agentRunData.getNumUsers(), tankHttpClientClass, threadGroup); + TestPlanStarter starter = new TestPlanStarter(httpClient, plan, agentRunData.getNumUsers(), tankHttpClientClass, threadGroup, agentRunData); testPlans.add(starter); LOG.info(new ObjectMessage(ImmutableMap.of("Message", "Users for Test Plan " + plan.getTestPlanName() + " at " + plan.getUserPercentage() @@ -535,7 +535,7 @@ public void runConcurrentTestPlans() { startTime = System.currentTimeMillis(); DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM); LOG.info(new ObjectMessage(ImmutableMap.of("Message", "Simulation start: " + df.format(new Date(getStartTime()))))); - if (agentRunData.getSimulationTime() != 0) { + if (agentRunData.getSimulationTimeMillis() != 0) { LOG.info(new ObjectMessage(ImmutableMap.of("Message", "Scheduled Simulation End : " + df.format(new Date(getSimulationEndTimeMillis()))))); LOG.info(new ObjectMessage(ImmutableMap.of("Message", "Max Simulation End : " @@ -630,7 +630,7 @@ public WatsAgentStatusResponse getStatus() { int ramp = (agentRunData.getNumUsers() - agentRunData.getNumStartUsers()); if (ramp > 0) { - ramp = (int) (agentRunData.getRampTime() - (agentRunData.getRampTime() * currentNumThreads) / + ramp = (int) (agentRunData.getRampTimeMillis() - (agentRunData.getRampTimeMillis() * currentNumThreads) / (agentRunData.getNumUsers() - agentRunData.getNumStartUsers())); } return new WatsAgentStatusResponse(System.currentTimeMillis() - startTime, @@ -661,11 +661,11 @@ public String getInstanceId() { } public long getSimulationEndTimeMillis() { - return getStartTime() + agentRunData.getSimulationTime(); + return getStartTime() + agentRunData.getSimulationTimeMillis(); } public boolean hasMetSimulationTime() { - if (agentRunData.getSimulationTime() > 0) { + if (agentRunData.getSimulationTimeMillis() > 0) { if (System.currentTimeMillis() > getSimulationEndTimeMillis()) { if (!loggedSimTime) { LOG.info(new ObjectMessage(ImmutableMap.of("Message", "Simulation time met"))); @@ -691,11 +691,7 @@ public long getMaxSimulationEndTimeMillis() { public void checkAgentThreads() { for (ThreadGroup threadGroup : threadGroupArray) { int activeCount = threadGroup.activeCount(); - Thread[] threads = new Thread[activeCount]; - threadGroup.enumerate(threads); - int activeThreads = (int) Arrays.stream(threads).filter(Objects::nonNull).filter( - t -> t.getState() == Thread.State.TIMED_WAITING || t.getState() == Thread.State.WAITING).count(); - LOG.info(LogUtil.getLogMessage("Have " + activeThreads + " of " + activeCount + LOG.info(LogUtil.getLogMessage("Have " + threadGroup.activeCount() + " active Threads in thread group " + threadGroup.getName())); } @@ -795,6 +791,8 @@ public FlowController getFlowController(Long threadId) { return ret; } + public int getCurrentUsers() { return currentUsers; } + /** * @return the started */ diff --git a/agent/apiharness/src/main/java/com/intuit/tank/harness/AgentRunData.java b/agent/apiharness/src/main/java/com/intuit/tank/harness/AgentRunData.java index 6e710aa2b..a22198917 100644 --- a/agent/apiharness/src/main/java/com/intuit/tank/harness/AgentRunData.java +++ b/agent/apiharness/src/main/java/com/intuit/tank/harness/AgentRunData.java @@ -58,17 +58,17 @@ public void setNumUsers(int numUsers) { } /** - * @return the rampTime + * @return the rampTime in milliseconds */ - public long getRampTime() { + public long getRampTimeMillis() { return rampTime; } /** * @param rampTime - * the rampTime to set + * the rampTime to set in milliseconds */ - public void setRampTime(long rampTime) { + public void setRampTimeMillis(long rampTime) { this.rampTime = rampTime; } @@ -195,17 +195,17 @@ public void setReportingMode(String reportingMode) { } /** - * @return the simulationTime + * @return the simulationTime in milliseconds */ - public long getSimulationTime() { + public long getSimulationTimeMillis() { return simulationTime; } /** * @param simulationTime - * the simulationTime to set + * the simulationTime to set in milliseconds */ - public void setSimulationTime(long simulationTime) { + public void setSimulationTimeMillis(long simulationTime) { this.simulationTime = simulationTime; } diff --git a/agent/apiharness/src/main/java/com/intuit/tank/harness/AgentUtil.java b/agent/apiharness/src/main/java/com/intuit/tank/harness/AgentUtil.java index 9ff3f53ba..1c86e81f4 100644 --- a/agent/apiharness/src/main/java/com/intuit/tank/harness/AgentUtil.java +++ b/agent/apiharness/src/main/java/com/intuit/tank/harness/AgentUtil.java @@ -14,6 +14,7 @@ */ import java.io.File; +import java.util.Arrays; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -32,18 +33,14 @@ public class AgentUtil { * @return TRUE if all test plans exist; FALSE if one or more do not exist */ public static boolean validateTestPlans(String plans) { - String[] testPlanLists = plans.split(","); - boolean output = true; - - for (String testPlanList : testPlanLists) { - File xmlFile = new File(testPlanList); - if (!xmlFile.exists()) { - LOG.error(LogUtil.getLogMessage("File not found: " + testPlanList)); - System.err.println("File not found: " + testPlanList); - output = false; - } - } - return output; + return Arrays.stream(plans.split(",")) + .allMatch(xmlFilePath -> { + if (new File(xmlFilePath).exists()) { + return true; + } + LOG.error(LogUtil.getLogMessage("File not found: " + xmlFilePath)); + System.err.println("File not found: " + xmlFilePath); + return false; + }); } - } diff --git a/agent/apiharness/src/main/java/com/intuit/tank/harness/TestPlanSingleton.java b/agent/apiharness/src/main/java/com/intuit/tank/harness/TestPlanSingleton.java index d51918671..69ca093bc 100644 --- a/agent/apiharness/src/main/java/com/intuit/tank/harness/TestPlanSingleton.java +++ b/agent/apiharness/src/main/java/com/intuit/tank/harness/TestPlanSingleton.java @@ -25,9 +25,7 @@ import org.apache.logging.log4j.Logger; import com.intuit.tank.harness.data.HDWorkload; -import com.intuit.tank.harness.logging.LogUtil; import com.intuit.tank.harness.parsers.WorkloadParser; -import com.intuit.tank.logging.LogEventType; public class TestPlanSingleton { private static final Logger LOG = LogManager.getLogger(TestPlanSingleton.class); @@ -47,18 +45,10 @@ private TestPlanSingleton() { } public void setTestPlans(String plans) { - List testPlanLists = Arrays.asList(plans.split(",")); - workloads = testPlanLists.stream() - .filter(xmlFile -> { - if (new File(xmlFile).exists()) { - return true; - } else { - Exception e = new Exception("File not found"); - LOG.error(LogUtil.getLogMessage(e.getMessage(), LogEventType.System), e); - return false; - } - }) + workloads = Arrays.stream(plans.split(",")) + .map(File::new) + .filter(File::exists) .map(xml -> new WorkloadParser(xml).getWorkload()) .filter(Objects::nonNull) .collect(Collectors.toList()); diff --git a/agent/apiharness/src/main/java/com/intuit/tank/harness/TestPlanStarter.java b/agent/apiharness/src/main/java/com/intuit/tank/harness/TestPlanStarter.java index b452f102d..9195a7681 100644 --- a/agent/apiharness/src/main/java/com/intuit/tank/harness/TestPlanStarter.java +++ b/agent/apiharness/src/main/java/com/intuit/tank/harness/TestPlanStarter.java @@ -31,26 +31,28 @@ public class TestPlanStarter implements Runnable { private final Object httpClient; private final HDTestPlan plan; private final int numThreads; - private final ThreadGroup threadGroup; private final String tankHttpClientClass; + private final ThreadGroup threadGroup; + private final AgentRunData agentRunData; private int threadsStarted = 0; private final long rampDelay; private boolean done = false; - public TestPlanStarter(Object httpClient, HDTestPlan plan, int numThreads, String tankHttpClientClass, ThreadGroup threadGroup) { + public TestPlanStarter(Object httpClient, HDTestPlan plan, int numThreads, String tankHttpClientClass, ThreadGroup threadGroup, AgentRunData agentRunData) { super(); this.httpClient = httpClient; this.plan = plan; - this.threadGroup = threadGroup; this.tankHttpClientClass = tankHttpClientClass; this.numThreads = (int) Math.max(1, Math.floor(numThreads * (plan.getUserPercentage() / 100D))); + this.threadGroup = threadGroup; + this.agentRunData = agentRunData; this.rampDelay = calcRampTime(); } public void run() { // start initial users - int numInitialUsers = APITestHarness.getInstance().getAgentRunData().getNumStartUsers(); + int numInitialUsers = agentRunData.getNumStartUsers(); if (threadsStarted < numInitialUsers && threadsStarted < numThreads) { LOG.info(new ObjectMessage(ImmutableMap.of("Message", "Starting initial " + numInitialUsers + " users for plan " + plan.getTestPlanName() + "..."))); @@ -66,7 +68,7 @@ public void run() { LOG.info(new ObjectMessage(ImmutableMap.of("Message", "Starting ramp of additional " + (numThreads - threadsStarted) + " users for plan " + plan.getTestPlanName() + "..."))); while (!done) { - if ((threadsStarted - numInitialUsers) % APITestHarness.getInstance().getAgentRunData().getUserInterval() == 0) { + if ((threadsStarted - numInitialUsers) % agentRunData.getUserInterval() == 0) { try { Thread.sleep(rampDelay); } catch (InterruptedException e) { @@ -90,15 +92,14 @@ public void run() { if ( APITestHarness.getInstance().getCmd() == AgentCommand.stop || APITestHarness.getInstance().getCmd() == AgentCommand.kill || APITestHarness.getInstance().hasMetSimulationTime() - || APITestHarness.getInstance().isDebug() ) { + || APITestHarness.getInstance().isDebug() + || (agentRunData.getSimulationTimeMillis() == 0 //Run Until: Loops Completed + && System.currentTimeMillis() - APITestHarness.getInstance().getStartTime() > agentRunData.getRampTimeMillis())) { done = true; break; } - if (threadGroup.activeCount() < numThreads) { - Thread thread = createThread(httpClient, threadsStarted); - thread.start(); - APITestHarness.getInstance().threadStarted(thread); - threadsStarted++; + if (APITestHarness.getInstance().getCurrentUsers() < numThreads) { + createThread(httpClient, threadsStarted); } } done = true; @@ -121,12 +122,12 @@ public boolean isDone() { } private long calcRampTime() { - int ramp = (numThreads - APITestHarness.getInstance().getAgentRunData().getNumStartUsers()); + int ramp = (numThreads - agentRunData.getNumStartUsers()); if (ramp > 0) { - return (APITestHarness.getInstance().getAgentRunData().getRampTime() * - APITestHarness.getInstance().getAgentRunData().getUserInterval()) + return (agentRunData.getRampTimeMillis() * + agentRunData.getUserInterval()) / ramp; - } else if (APITestHarness.getInstance().getAgentRunData().getRampTime() > 0) { + } else if (agentRunData.getRampTimeMillis() > 0) { LOG.info(LogUtil.getLogMessage("No Ramp - " + rampDelay, LogEventType.System)); } return 1; //Return minimum wait time 1 millisecond @@ -137,6 +138,9 @@ private Thread createThread(Object httpClient, int threadNumber) { Thread thread = new Thread(threadGroup, session, "AGENT"); thread.setDaemon(true);// system won't shut down normally until all user threads stop session.setUniqueName(threadGroup.getName() + "-" + thread.getId()); + thread.start(); + APITestHarness.getInstance().threadStarted(thread); + threadsStarted++; return thread; } } diff --git a/agent/apiharness/src/main/java/com/intuit/tank/harness/functions/JexlIOFunctions.java b/agent/apiharness/src/main/java/com/intuit/tank/harness/functions/JexlIOFunctions.java index a0d13233c..9c3c02525 100644 --- a/agent/apiharness/src/main/java/com/intuit/tank/harness/functions/JexlIOFunctions.java +++ b/agent/apiharness/src/main/java/com/intuit/tank/harness/functions/JexlIOFunctions.java @@ -45,7 +45,7 @@ public static void resetStatics() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void visit(JexlContext context) { diff --git a/agent/apiharness/src/main/java/com/intuit/tank/harness/functions/JexlNumericFunctions.java b/agent/apiharness/src/main/java/com/intuit/tank/harness/functions/JexlNumericFunctions.java index 987fc84c3..028beefcf 100644 --- a/agent/apiharness/src/main/java/com/intuit/tank/harness/functions/JexlNumericFunctions.java +++ b/agent/apiharness/src/main/java/com/intuit/tank/harness/functions/JexlNumericFunctions.java @@ -38,7 +38,7 @@ public class JexlNumericFunctions implements ExpressionContextVisitor { /** * - * @inheritDoc + * {@inheritDoc} */ @Override public void visit(JexlContext context) { diff --git a/agent/apiharness/src/main/java/com/intuit/tank/harness/functions/JexlStringFunctions.java b/agent/apiharness/src/main/java/com/intuit/tank/harness/functions/JexlStringFunctions.java index 7a11ab1b9..2acb836ab 100644 --- a/agent/apiharness/src/main/java/com/intuit/tank/harness/functions/JexlStringFunctions.java +++ b/agent/apiharness/src/main/java/com/intuit/tank/harness/functions/JexlStringFunctions.java @@ -76,7 +76,7 @@ public class JexlStringFunctions implements ExpressionContextVisitor { static private Hashtable> stackMap = new Hashtable>(); /** - * @inheritDoc + * {@inheritDoc} */ @Override public void visit(JexlContext context) { diff --git a/agent/apiharness/src/main/java/com/intuit/tank/harness/logging/LogEvent.java b/agent/apiharness/src/main/java/com/intuit/tank/harness/logging/LogEvent.java index 363c98060..5b7950198 100644 --- a/agent/apiharness/src/main/java/com/intuit/tank/harness/logging/LogEvent.java +++ b/agent/apiharness/src/main/java/com/intuit/tank/harness/logging/LogEvent.java @@ -194,7 +194,11 @@ private String getVariableValues() { StringBuilder sb = new StringBuilder(); if (variables != null) { for (Entry entry : variables.getVaribleValues().entrySet()) { - if (!entry.getKey().toUpperCase().startsWith("UUID_")) { // Exclude UUID variables, there are just too many. + if (entry.getKey().equalsIgnoreCase("password")) { + appendField(sb, entry.getKey(), "********", "="); // Obfuscate password entries + } + + else if (!entry.getKey().toUpperCase().startsWith("UUID_")) { // Exclude UUID variables, there are just too many. appendField(sb, entry.getKey(), entry.getValue(), "="); } } diff --git a/agent/apiharness/src/main/java/com/intuit/tank/harness/logging/ThreadLocalLogEvent.java b/agent/apiharness/src/main/java/com/intuit/tank/harness/logging/ThreadLocalLogEvent.java index 3312e4927..10fcaca4e 100644 --- a/agent/apiharness/src/main/java/com/intuit/tank/harness/logging/ThreadLocalLogEvent.java +++ b/agent/apiharness/src/main/java/com/intuit/tank/harness/logging/ThreadLocalLogEvent.java @@ -44,6 +44,7 @@ public LogEvent initialValue() { ThreadContext.put("location", AmazonUtil.getZone()); ThreadContext.put("httpHost", AmazonUtil.getControllerBaseUrl()); ThreadContext.put("loggingProfile", APITestHarness.getInstance().getAgentRunData().getActiveProfile().getDisplayName()); + ThreadContext.put("env", APITestHarness.getInstance().getTankConfig().getInstanceName()); return logEvent; diff --git a/agent/apiharness/src/main/java/com/intuit/tank/harness/test/data/DataItem.java b/agent/apiharness/src/main/java/com/intuit/tank/harness/test/data/DataItem.java index be6a502cd..a6e92e05c 100644 --- a/agent/apiharness/src/main/java/com/intuit/tank/harness/test/data/DataItem.java +++ b/agent/apiharness/src/main/java/com/intuit/tank/harness/test/data/DataItem.java @@ -91,7 +91,7 @@ public void setValue(String newValue) { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public String toString() { diff --git a/agent/apiharness/src/main/java/com/intuit/tank/harness/test/data/ValidationItem.java b/agent/apiharness/src/main/java/com/intuit/tank/harness/test/data/ValidationItem.java index 67df18fdd..8321db00e 100644 --- a/agent/apiharness/src/main/java/com/intuit/tank/harness/test/data/ValidationItem.java +++ b/agent/apiharness/src/main/java/com/intuit/tank/harness/test/data/ValidationItem.java @@ -47,7 +47,7 @@ public String getCondition() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public String toString() { diff --git a/agent/apiharness/src/main/java/com/intuit/tank/harness/test/data/Variables.java b/agent/apiharness/src/main/java/com/intuit/tank/harness/test/data/Variables.java index 8c21b3454..9e4bf5ee9 100644 --- a/agent/apiharness/src/main/java/com/intuit/tank/harness/test/data/Variables.java +++ b/agent/apiharness/src/main/java/com/intuit/tank/harness/test/data/Variables.java @@ -293,7 +293,7 @@ public String getValue() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public String toString() { diff --git a/agent/apiharness/src/main/java/com/intuit/tank/runner/TestPlanRunner.java b/agent/apiharness/src/main/java/com/intuit/tank/runner/TestPlanRunner.java index ca6aafeb5..3a96db1b9 100644 --- a/agent/apiharness/src/main/java/com/intuit/tank/runner/TestPlanRunner.java +++ b/agent/apiharness/src/main/java/com/intuit/tank/runner/TestPlanRunner.java @@ -17,6 +17,7 @@ import java.util.Map; import java.util.UUID; +import com.intuit.tank.harness.StopBehavior; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -145,8 +146,8 @@ public void run() { i = 0; continue mainLoop; } - if (isCompleted(RunPhase.group, finished)) { - LOG.info(LogUtil.getLogMessage("finished or Stop set to group or less, exiting at group " + hdScriptGroup.getName())); + if (isCompleted(StopBehavior.END_OF_SCRIPT_GROUP, finished)) { + LOG.info(LogUtil.getLogMessage("finished or Stop set to end of script group, exiting at group " + hdScriptGroup.getName())); return; } scriptGroupLoop++; @@ -211,8 +212,11 @@ private void runTestGroup(List scripts, HDScriptGroup parent) LOG.info(LogUtil.getLogMessage(mt1.getNaturalTimeMessage())); APITestHarness.getInstance().getUserTracker().remove(hdscript.getName()); } - if (shouldStop(RunPhase.script)) { - throw new KillScriptException("Stop set to script or less, exiting at script " + hdscript.getName()); + // If stop command received, and stop behavior is end of script, exit here. + if (shouldStop(StopBehavior.END_OF_SCRIPT)) { + LOG.info(LogUtil.getLogMessage("Stop command received. Stop set to end of script. End of script " + + hdscript.getName() + " reached. Exiting...")); + return; } } } finally { @@ -223,23 +227,21 @@ private void runTestGroup(List scripts, HDScriptGroup parent) /** * Check to see if the thread/virtual user should continue for another loop * - * @param phase + * @param stopBehavior * @param finished * * @return */ - private boolean isCompleted(RunPhase phase, boolean finished) { - return (shouldStop(phase) - || (finished && (APITestHarness.getInstance().getAgentRunData().getSimulationTime() <= 0 + private boolean isCompleted(StopBehavior stopBehavior, boolean finished) { + return (shouldStop(stopBehavior) + || (finished && (APITestHarness.getInstance().getAgentRunData().getSimulationTimeMillis() <= 0 || APITestHarness.getInstance().hasMetSimulationTime() || APITestHarness.getInstance().isDebug()))); } - private boolean shouldStop(RunPhase phase) { - if (APITestHarness.getInstance().getCmd() == AgentCommand.stop) { - return phase.ordinal() >= APITestHarness.getInstance().getAgentRunData().getStopBehavior().ordinal(); - } - return false; + private boolean shouldStop(StopBehavior stopBehavior) { + return APITestHarness.getInstance().getCmd() == AgentCommand.stop && + APITestHarness.getInstance().getAgentRunData().getStopBehavior() == stopBehavior; } private boolean checkGotoGroupUseCase(HDScriptUseCase hdScriptUseCase, String gotoGroup) { @@ -360,8 +362,10 @@ private void runScriptSteps(HDScriptUseCase hdScriptUseCase) throws KillScriptEx throw new GotoScriptException("Go to group " + gotoGroup, gotoGroup); } } - if (shouldStop(RunPhase.step)) { - LOG.info(LogUtil.getLogMessage("Stop set to step, exiting at step " + testStep.getStepIndex())); + // If command is stop and stop behavior is end of step, exit the loop. + if (shouldStop(StopBehavior.END_OF_STEP)) { + LOG.info(LogUtil.getLogMessage("Stop command received. Stop set to end of step. End of step " + + testStep.getStepIndex() + " reached. Exiting...")); return; } } diff --git a/agent/apiharness/src/main/java/com/intuit/tank/runner/method/AgentLoggingOutputLogger.java b/agent/apiharness/src/main/java/com/intuit/tank/runner/method/AgentLoggingOutputLogger.java index 3f87e0335..2913a92f6 100644 --- a/agent/apiharness/src/main/java/com/intuit/tank/runner/method/AgentLoggingOutputLogger.java +++ b/agent/apiharness/src/main/java/com/intuit/tank/runner/method/AgentLoggingOutputLogger.java @@ -35,7 +35,7 @@ public class AgentLoggingOutputLogger implements OutputLogger { private static final Logger LOG = LogManager.getLogger(AgentLoggingOutputLogger.class); /** - * @inheritDoc + * {@inheritDoc} */ @Override public void setScrollContent(boolean autoScroll) { @@ -44,7 +44,7 @@ public void setScrollContent(boolean autoScroll) { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public void log(String text) { diff --git a/agent/apiharness/src/main/resources/log4j2.xml b/agent/apiharness/src/main/resources/log4j2.xml index ce2ac7b9c..24a9fed93 100644 --- a/agent/apiharness/src/main/resources/log4j2.xml +++ b/agent/apiharness/src/main/resources/log4j2.xml @@ -17,6 +17,7 @@ + diff --git a/agent/apiharness/src/test/java/com/intuit/tank/harness/AgentRunDataTest.java b/agent/apiharness/src/test/java/com/intuit/tank/harness/AgentRunDataTest.java index 5071736f4..78222f35c 100644 --- a/agent/apiharness/src/test/java/com/intuit/tank/harness/AgentRunDataTest.java +++ b/agent/apiharness/src/test/java/com/intuit/tank/harness/AgentRunDataTest.java @@ -17,8 +17,6 @@ import static org.junit.jupiter.api.Assertions.*; -import com.intuit.tank.harness.AgentRunData; -import com.intuit.tank.harness.StopBehavior; import com.intuit.tank.logging.LoggingProfile; /** @@ -50,8 +48,8 @@ public void testAgentRunData_1() public void testGetActiveProfile_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -83,8 +81,8 @@ public void testGetActiveProfile_1() public void testGetAgentInstanceNum_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -116,8 +114,8 @@ public void testGetAgentInstanceNum_1() public void testGetInstanceId_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -149,8 +147,8 @@ public void testGetInstanceId_1() public void testGetJobId_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -182,8 +180,8 @@ public void testGetJobId_1() public void testGetMachineName_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -215,8 +213,8 @@ public void testGetMachineName_1() public void testGetNumStartUsers_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -248,8 +246,8 @@ public void testGetNumStartUsers_1() public void testGetNumUsers_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -283,8 +281,8 @@ public void testGetNumUsers_1() public void testGetProjectName_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -316,8 +314,8 @@ public void testGetProjectName_1() public void testGetRampTime_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -331,7 +329,7 @@ public void testGetRampTime_1() fixture.setInstanceId(""); fixture.setTestPlans(""); - long result = fixture.getRampTime(); + long result = fixture.getRampTimeMillis(); // An unexpected exception was thrown in user code while executing this test: // java.lang.NoClassDefFoundError: Could not initialize class com.intuit.tank.harness.AgentRunData @@ -349,8 +347,8 @@ public void testGetRampTime_1() public void testGetReportingMode_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -382,8 +380,8 @@ public void testGetReportingMode_1() public void testGetSimulationTime_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -397,7 +395,7 @@ public void testGetSimulationTime_1() fixture.setInstanceId(""); fixture.setTestPlans(""); - long result = fixture.getSimulationTime(); + long result = fixture.getSimulationTimeMillis(); // An unexpected exception was thrown in user code while executing this test: // java.lang.NoClassDefFoundError: Could not initialize class com.intuit.tank.harness.AgentRunData @@ -415,8 +413,8 @@ public void testGetSimulationTime_1() public void testGetStopBehavior_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -448,8 +446,8 @@ public void testGetStopBehavior_1() public void testGetTestPlans_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -481,8 +479,8 @@ public void testGetTestPlans_1() public void testGetTotalAgents_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -514,8 +512,8 @@ public void testGetTotalAgents_1() public void testGetUserInterval_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -547,8 +545,8 @@ public void testGetUserInterval_1() public void testSetActiveProfile_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -580,8 +578,8 @@ public void testSetActiveProfile_1() public void testSetAgentInstanceNum_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -613,8 +611,8 @@ public void testSetAgentInstanceNum_1() public void testSetInstanceId_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -646,8 +644,8 @@ public void testSetInstanceId_1() public void testSetJobId_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -679,8 +677,8 @@ public void testSetJobId_1() public void testSetMachineName_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -712,8 +710,8 @@ public void testSetMachineName_1() public void testSetNumStartUsers_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -745,8 +743,8 @@ public void testSetNumStartUsers_1() public void testSetNumUsers_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -778,8 +776,8 @@ public void testSetNumUsers_1() public void testSetProjectName_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -811,8 +809,8 @@ public void testSetProjectName_1() public void testSetRampTime_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -827,7 +825,7 @@ public void testSetRampTime_1() fixture.setTestPlans(""); long rampTime = 1L; - fixture.setRampTime(rampTime); + fixture.setRampTimeMillis(rampTime); // An unexpected exception was thrown in user code while executing this test: // java.lang.NoClassDefFoundError: Could not initialize class com.intuit.tank.harness.AgentRunData @@ -844,8 +842,8 @@ public void testSetRampTime_1() public void testSetReportingMode_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -877,8 +875,8 @@ public void testSetReportingMode_1() public void testSetSimulationTime_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -893,7 +891,7 @@ public void testSetSimulationTime_1() fixture.setTestPlans(""); long simulationTime = 1L; - fixture.setSimulationTime(simulationTime); + fixture.setSimulationTimeMillis(simulationTime); // An unexpected exception was thrown in user code while executing this test: // java.lang.NoClassDefFoundError: Could not initialize class com.intuit.tank.harness.AgentRunData @@ -910,8 +908,8 @@ public void testSetSimulationTime_1() public void testSetStopBehavior_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -943,8 +941,8 @@ public void testSetStopBehavior_1() public void testSetTestPlans_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -976,8 +974,8 @@ public void testSetTestPlans_1() public void testSetTotalAgents_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -1009,8 +1007,8 @@ public void testSetTotalAgents_1() public void testSetUserInterval_1() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); @@ -1042,8 +1040,8 @@ public void testSetUserInterval_1() public void testSetUserInterval_2() throws Exception { AgentRunData fixture = new AgentRunData(); - fixture.setSimulationTime(1L); - fixture.setRampTime(1L); + fixture.setSimulationTimeMillis(1L); + fixture.setRampTimeMillis(1L); fixture.setNumStartUsers(1); fixture.setJobId(""); fixture.setProjectName(""); diff --git a/agent/apiharness/src/test/java/com/intuit/tank/harness/AgentUtilTest.java b/agent/apiharness/src/test/java/com/intuit/tank/harness/AgentUtilTest.java index 41b3c51fb..55c4a7e6b 100644 --- a/agent/apiharness/src/test/java/com/intuit/tank/harness/AgentUtilTest.java +++ b/agent/apiharness/src/test/java/com/intuit/tank/harness/AgentUtilTest.java @@ -11,7 +11,7 @@ import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.*; public class AgentUtilTest { @@ -22,10 +22,29 @@ public class AgentUtilTest { */ @Test @Tag(TestGroups.FUNCTIONAL) - public void validateTestPlans() { + public void validateTestPlans_Empty() { boolean result = AgentUtil.validateTestPlans(""); - assertNotNull(result, "result cannot be null"); + assertFalse(result, "TestPlan list should not be null"); } - + @Test + @Tag(TestGroups.FUNCTIONAL) + public void validateTestPlans_Good() { + boolean result = AgentUtil.validateTestPlans("src/test/resources/TEST_H.xml"); + assertTrue(result, "Test file should exists"); + } + + @Test + @Tag(TestGroups.FUNCTIONAL) + public void validateTestPlans_Bad() { + boolean result = AgentUtil.validateTestPlans("NOTFOUND.xml"); + assertFalse(result, "File should not be found"); + } + + @Test + @Tag(TestGroups.FUNCTIONAL) + public void validateTestPlans_Bad2() { + boolean result = AgentUtil.validateTestPlans("src/test/resources/TEST_H.xml, NOTFOUND.xml"); + assertFalse(result, "Contains a File Not Found in list"); + } } diff --git a/agent/apiharness/src/test/java/com/intuit/tank/harness/TestPlanStarterTest.java b/agent/apiharness/src/test/java/com/intuit/tank/harness/TestPlanStarterTest.java new file mode 100644 index 000000000..5803920d6 --- /dev/null +++ b/agent/apiharness/src/test/java/com/intuit/tank/harness/TestPlanStarterTest.java @@ -0,0 +1,68 @@ +package com.intuit.tank.harness; + +import com.intuit.tank.harness.data.HDTestPlan; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.Mockito.*; + +public class TestPlanStarterTest { + + private Object _httpClientMock; + private HDTestPlan _hdTestPlanMock; + private ThreadGroup _threadGroupMock; + private AgentRunData _agentRunData; + + private final String _tankHttpClientClassStub = "com.intuit.tank.httpclient4.TankHttpClient4"; + private final int _threadCountStub = 10; + + private TestPlanStarter _sut; + + @BeforeEach + public void SetUp() { + _httpClientMock = mock(Object.class); + _hdTestPlanMock = mock(HDTestPlan.class); + _threadGroupMock = mock(ThreadGroup.class); + _agentRunData = mock(AgentRunData.class); + } + + @Test + public void getPlan_Returns_Initialized_HDTestPlan() { + // Arrange + Act + _sut = new TestPlanStarter(_httpClientMock, _hdTestPlanMock, 1, _tankHttpClientClassStub, _threadGroupMock, _agentRunData); + + // Assert + assertEquals(_hdTestPlanMock, _sut.getPlan(), "TestPlan assigned to TestPlanStarter"); + } + + @Test + public void getNumThreads_Returns_Initialized_Number_Of_Threads() { + // Arrange + when(_hdTestPlanMock.getUserPercentage()).thenReturn(100); + + // Act + _sut = new TestPlanStarter(_httpClientMock, _hdTestPlanMock, _threadCountStub, _tankHttpClientClassStub, _threadGroupMock, _agentRunData); + + // Assert + assertEquals(_threadCountStub, _sut.getNumThreads()); + } + + @Test + public void getThreadStarted_Given_TestPlanStarter_Not_Run_Returns_Zero() { + // Arrange + Act + _sut = new TestPlanStarter(_httpClientMock, _hdTestPlanMock, 1, _tankHttpClientClassStub, _threadGroupMock, _agentRunData); + + // Assert + assertEquals(0, _sut.getThreadsStarted()); + } + + @Test + public void isDone_Given_TestPlanStarter_Not_Run_Returns_False() { + // Arrange + Act + _sut = new TestPlanStarter(_httpClientMock, _hdTestPlanMock, 1, _tankHttpClientClassStub, _threadGroupMock, _agentRunData); + + // Assert + assertFalse(_sut.isDone()); + } +} diff --git a/agent/apiharness/src/test/java/com/intuit/tank/harness/logging/LogEventTest.java b/agent/apiharness/src/test/java/com/intuit/tank/harness/logging/LogEventTest.java index 237facc86..66714f11c 100644 --- a/agent/apiharness/src/test/java/com/intuit/tank/harness/logging/LogEventTest.java +++ b/agent/apiharness/src/test/java/com/intuit/tank/harness/logging/LogEventTest.java @@ -2,6 +2,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.*; import java.util.Map; @@ -190,6 +191,45 @@ public void testBuildMessage_3() assertNotNull(result); } + /** + * Run String buildMessage() method test and validate password user variable field obfuscated + */ + @Test + public void testBuildMessage_4() { + LogEvent fixture = new LogEvent(); + Variables variables = new Variables(); + String passwordStub = "LoginPassword123"; + variables.addVariable("password", passwordStub); + + fixture.setHostname(""); + fixture.setActiveProfile(LoggingProfile.USER_VARIABLE); + fixture.setEventType(LogEventType.Http); + fixture.setTestPlan(new HDTestPlan()); + fixture.setValidationStatus(""); + fixture.setVariables(variables); + fixture.setThreadId(""); + fixture.setPublicIp(""); + fixture.setProjectName(""); + fixture.setGroup(new HDScriptGroup()); + fixture.setJobId(""); + fixture.setRequest(new MockRequest()); + fixture.setLoggingKey(""); + fixture.setTransactionId(""); + fixture.setStepGroupName(""); + fixture.setSourceType(SourceType.agent); + fixture.setInstanceId(""); + fixture.setStep((TestStep) null); + fixture.setStepIndex(""); + fixture.setMessage(""); + fixture.setIteration(""); + fixture.setScript((HDScript) null); + + Map result = fixture.buildMessage(); + assertNotNull(result); + assertTrue(result.containsKey("UserVariables")); + assertFalse(result.get("UserVariables").equalsIgnoreCase(passwordStub)); + } + /** * Run the LoggingProfile getActiveProfile() method test. * diff --git a/agent/apiharness_pkg/pom.xml b/agent/apiharness_pkg/pom.xml index 7e40e1c91..88168cde5 100644 --- a/agent/apiharness_pkg/pom.xml +++ b/agent/apiharness_pkg/pom.xml @@ -6,7 +6,7 @@ com.intuit.tank agent-parent - 3.0.2 + 3.1.0 apiharness diff --git a/agent/http_client_3/pom.xml b/agent/http_client_3/pom.xml index 2b21b5dbb..6ca7784c4 100644 --- a/agent/http_client_3/pom.xml +++ b/agent/http_client_3/pom.xml @@ -5,7 +5,7 @@ com.intuit.tank agent-parent - 3.0.2 + 3.1.0 http_client_apache_3 diff --git a/agent/http_client_4/pom.xml b/agent/http_client_4/pom.xml index 3b1fe2ca5..06163d6f7 100644 --- a/agent/http_client_4/pom.xml +++ b/agent/http_client_4/pom.xml @@ -5,7 +5,7 @@ com.intuit.tank agent-parent - 3.0.2 + 3.1.0 http_client_apache_4 diff --git a/agent/http_client_5/pom.xml b/agent/http_client_5/pom.xml index 1fe3b4827..08141294b 100644 --- a/agent/http_client_5/pom.xml +++ b/agent/http_client_5/pom.xml @@ -5,7 +5,7 @@ com.intuit.tank agent-parent - 3.0.2 + 3.1.0 http_client_apache_5 diff --git a/agent/pom.xml b/agent/pom.xml index f8b1c3096..c3abd0b0a 100644 --- a/agent/pom.xml +++ b/agent/pom.xml @@ -6,7 +6,7 @@ com.intuit.tank tank-parent - 3.0.2 + 3.1.0 agent-parent diff --git a/all-in-one.sh b/all-in-one.sh index ea9cbb4f6..747f593b6 100644 --- a/all-in-one.sh +++ b/all-in-one.sh @@ -16,7 +16,7 @@ mkdir $INSTALL_DIR/tomcat/db 2>/dev/null mkdir $INSTALL_DIR/tomcat/jars 2>/dev/null echo "downloading and extracting agent-standalone..." -wget -O /tmp/agent-standalone-pkg.zip https://github.com/intuit/Tank/releases/download/3.0.0/agent-standalone-pkg.zip 2>/dev/null +wget -O /tmp/agent-standalone-pkg.zip https://github.com/intuit/Tank/releases/download/3.1.0/agent-standalone-pkg.zip 2>/dev/null unzip -q -d $INSTALL_DIR /tmp/agent-standalone-pkg 2>/dev/null rm -f /tmp/agent-standalone-pkg 2>/dev/null @@ -26,7 +26,7 @@ wget -O /$INSTALL_DIR/tomcat/settings.xml https://github.com/intuit/Tank/blob/ma echo "downloading and installing tank war file..." rm -fr $INSTALL_DIR/tomcat/webapps/docs $INSTALL_DIR/tomcat/webapps/examples $INSTALL_DIR/tomcat/webapps/ROOT 2>/dev/null -wget -O $INSTALL_DIR/tomcat/webapps/ROOT.war https://github.com/intuit/Tank/releases/download/3.0.0/tank.war 2>/dev/null +wget -O $INSTALL_DIR/tomcat/webapps/ROOT.war https://github.com/intuit/Tank/releases/download/3.1.0/tank.war 2>/dev/null echo "Creating context file at $INSTALL_DIR/start.sh ..." cat << EOF > $INSTALL_DIR/tomcat/conf/context.xml diff --git a/api/pom.xml b/api/pom.xml index 352554363..5d2796487 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -6,7 +6,7 @@ com.intuit.tank tank-parent - 3.0.2 + 3.1.0 api diff --git a/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentAvailability.java b/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentAvailability.java index 090a152fb..81fae76e1 100644 --- a/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentAvailability.java +++ b/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentAvailability.java @@ -97,7 +97,7 @@ public Date getTimestamp() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public boolean equals(Object obj) { @@ -109,7 +109,7 @@ public boolean equals(Object obj) { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public int hashCode() { diff --git a/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentData.java b/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentData.java index 22b074b11..ba774ace5 100644 --- a/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentData.java +++ b/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentData.java @@ -115,7 +115,7 @@ public String toString() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public boolean equals(Object obj) { @@ -127,7 +127,7 @@ public boolean equals(Object obj) { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public int hashCode() { diff --git a/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentMngrAPIRequest.java b/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentMngrAPIRequest.java index 60c2bd95f..586c8b665 100644 --- a/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentMngrAPIRequest.java +++ b/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentMngrAPIRequest.java @@ -55,7 +55,7 @@ public String getJobId() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public String toString() { diff --git a/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentMngrAPIResponse.java b/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentMngrAPIResponse.java index bfd3cf189..e652ef387 100644 --- a/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentMngrAPIResponse.java +++ b/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentMngrAPIResponse.java @@ -78,7 +78,7 @@ public void setRegion(VMRegion region) { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public String toString() { diff --git a/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentTestStartData.java b/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentTestStartData.java index 815af9f84..616520d7a 100644 --- a/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentTestStartData.java +++ b/api/src/main/java/com/intuit/tank/vm/agent/messages/AgentTestStartData.java @@ -194,7 +194,7 @@ public void setTotalAgents(int totalAgents) { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public String toString() { diff --git a/api/src/main/java/com/intuit/tank/vm/agent/messages/StandaloneAgentRequest.java b/api/src/main/java/com/intuit/tank/vm/agent/messages/StandaloneAgentRequest.java index 5ee3c6f6b..6d058b704 100644 --- a/api/src/main/java/com/intuit/tank/vm/agent/messages/StandaloneAgentRequest.java +++ b/api/src/main/java/com/intuit/tank/vm/agent/messages/StandaloneAgentRequest.java @@ -122,7 +122,7 @@ public void setStopBehavior(String stopBehavior) { /** * - * @inheritDoc + * {@inheritDoc} */ @Override public String toString() { @@ -130,7 +130,7 @@ public String toString() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public boolean equals(Object obj) { @@ -142,7 +142,7 @@ public boolean equals(Object obj) { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public int hashCode() { diff --git a/api/src/main/java/com/intuit/tank/vm/agent/messages/WatsAgentStartRequest.java b/api/src/main/java/com/intuit/tank/vm/agent/messages/WatsAgentStartRequest.java index 1598ee145..9bf06ef8f 100644 --- a/api/src/main/java/com/intuit/tank/vm/agent/messages/WatsAgentStartRequest.java +++ b/api/src/main/java/com/intuit/tank/vm/agent/messages/WatsAgentStartRequest.java @@ -174,7 +174,7 @@ public void setTotalAgents(int totalAgents) { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public String toString() { diff --git a/api/src/main/java/com/intuit/tank/vm/api/enumerated/VMRegion.java b/api/src/main/java/com/intuit/tank/vm/api/enumerated/VMRegion.java index 007b3fd5c..afabaf2bf 100644 --- a/api/src/main/java/com/intuit/tank/vm/api/enumerated/VMRegion.java +++ b/api/src/main/java/com/intuit/tank/vm/api/enumerated/VMRegion.java @@ -78,7 +78,7 @@ public String getDescription() { /** * - * @inheritDoc + * {@inheritDoc} */ public String toString() { return description; diff --git a/api/src/main/java/com/intuit/tank/vm/common/util/JSONBuilder.java b/api/src/main/java/com/intuit/tank/vm/common/util/JSONBuilder.java index 52b245cf6..17e5afc61 100644 --- a/api/src/main/java/com/intuit/tank/vm/common/util/JSONBuilder.java +++ b/api/src/main/java/com/intuit/tank/vm/common/util/JSONBuilder.java @@ -158,7 +158,7 @@ public JSONObject getJson() { } /** - * @inheritDoc + * {@inheritDoc} */ public String toJsonString(int indent) { try { @@ -169,7 +169,7 @@ public String toJsonString(int indent) { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public String toString() { diff --git a/api/src/main/java/com/intuit/tank/vm/common/util/MessageObject.java b/api/src/main/java/com/intuit/tank/vm/common/util/MessageObject.java index c10857c29..df4d621ed 100644 --- a/api/src/main/java/com/intuit/tank/vm/common/util/MessageObject.java +++ b/api/src/main/java/com/intuit/tank/vm/common/util/MessageObject.java @@ -39,7 +39,7 @@ public void setObject(Object o) { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public String toString() { diff --git a/api/src/main/java/com/intuit/tank/vm/event/JobEvent.java b/api/src/main/java/com/intuit/tank/vm/event/JobEvent.java index fe3b7b296..4c7896ae6 100644 --- a/api/src/main/java/com/intuit/tank/vm/event/JobEvent.java +++ b/api/src/main/java/com/intuit/tank/vm/event/JobEvent.java @@ -85,7 +85,7 @@ public JobLifecycleEvent getEvent() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public String toString() { diff --git a/api/src/main/java/com/intuit/tank/vm/event/NotificationContext.java b/api/src/main/java/com/intuit/tank/vm/event/NotificationContext.java index cacd941f2..367f46188 100644 --- a/api/src/main/java/com/intuit/tank/vm/event/NotificationContext.java +++ b/api/src/main/java/com/intuit/tank/vm/event/NotificationContext.java @@ -55,7 +55,7 @@ public String replaceValues(String content) { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public String toString() { diff --git a/api/src/main/java/com/intuit/tank/vm/exception/WatsParseException.java b/api/src/main/java/com/intuit/tank/vm/exception/WatsParseException.java index 25acdcc18..cd4852e41 100644 --- a/api/src/main/java/com/intuit/tank/vm/exception/WatsParseException.java +++ b/api/src/main/java/com/intuit/tank/vm/exception/WatsParseException.java @@ -53,7 +53,7 @@ public int getColumn() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public String getMessage() { diff --git a/api/src/main/java/com/intuit/tank/vm/settings/DefaultUser.java b/api/src/main/java/com/intuit/tank/vm/settings/DefaultUser.java index 22bb6c154..29a200d4e 100644 --- a/api/src/main/java/com/intuit/tank/vm/settings/DefaultUser.java +++ b/api/src/main/java/com/intuit/tank/vm/settings/DefaultUser.java @@ -88,7 +88,7 @@ public Set getGroups() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public String toString() { @@ -96,7 +96,7 @@ public String toString() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public boolean equals(Object obj) { @@ -108,7 +108,7 @@ public boolean equals(Object obj) { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public int hashCode() { diff --git a/api/src/main/java/com/intuit/tank/vm/settings/MailMessage.java b/api/src/main/java/com/intuit/tank/vm/settings/MailMessage.java index 44f0a6310..5802abdfe 100644 --- a/api/src/main/java/com/intuit/tank/vm/settings/MailMessage.java +++ b/api/src/main/java/com/intuit/tank/vm/settings/MailMessage.java @@ -95,7 +95,7 @@ public String getHtmlBody() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public String toString() { diff --git a/api/src/main/java/com/intuit/tank/vm/settings/ReportingInstance.java b/api/src/main/java/com/intuit/tank/vm/settings/ReportingInstance.java index b677cd122..5e9aca329 100644 --- a/api/src/main/java/com/intuit/tank/vm/settings/ReportingInstance.java +++ b/api/src/main/java/com/intuit/tank/vm/settings/ReportingInstance.java @@ -92,7 +92,7 @@ public String getZone() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public String toString() { diff --git a/api/src/main/java/com/intuit/tank/vm/settings/SelectableItem.java b/api/src/main/java/com/intuit/tank/vm/settings/SelectableItem.java index 79c2c19b1..918c298f0 100644 --- a/api/src/main/java/com/intuit/tank/vm/settings/SelectableItem.java +++ b/api/src/main/java/com/intuit/tank/vm/settings/SelectableItem.java @@ -56,7 +56,7 @@ public String getValue() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public int compareTo(SelectableItem o) { diff --git a/api/src/main/java/com/intuit/tank/vm/vmManager/JobRequestImpl.java b/api/src/main/java/com/intuit/tank/vm/vmManager/JobRequestImpl.java index bbc007110..ca3759652 100644 --- a/api/src/main/java/com/intuit/tank/vm/vmManager/JobRequestImpl.java +++ b/api/src/main/java/com/intuit/tank/vm/vmManager/JobRequestImpl.java @@ -93,7 +93,7 @@ public String getStopBehavior() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public String getId() { @@ -101,7 +101,7 @@ public String getId() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public IncrementStrategy getIncrementStrategy() { @@ -109,7 +109,7 @@ public IncrementStrategy getIncrementStrategy() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public String getLocation() { @@ -117,7 +117,7 @@ public String getLocation() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public TerminationPolicy getTerminationPolicy() { @@ -125,7 +125,7 @@ public TerminationPolicy getTerminationPolicy() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public long getRampTime() { @@ -133,7 +133,7 @@ public long getRampTime() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public int getBaselineVirtualUsers() { @@ -141,7 +141,7 @@ public int getBaselineVirtualUsers() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public long getSimulationTime() { @@ -149,7 +149,7 @@ public long getSimulationTime() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public int getUserIntervalIncrement() { @@ -157,7 +157,7 @@ public int getUserIntervalIncrement() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public String getReportingMode() { @@ -202,7 +202,7 @@ public void setNumUsersPerAgent(int numUsersPerAgent) { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public int getTotalVirtualUsers() { @@ -210,7 +210,7 @@ public int getTotalVirtualUsers() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public JobQueueStatus getStatus() { @@ -218,7 +218,7 @@ public JobQueueStatus getStatus() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public Set getRegions() { @@ -226,7 +226,7 @@ public Set getRegions() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public Set getNotifications() { @@ -234,7 +234,7 @@ public Set getNotifications() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public Set getDataFileIds() { @@ -242,7 +242,7 @@ public Set getDataFileIds() { } /** - * @inheritDoc private String id; + * {@inheritDoc} private String id; * * private IncrementStrategy incrementStrategy = IncrementStrategy.increasing; private Location * location = Location.san_diego; private TerminationPolicy terminationPolicy = TerminationPolicy.time; @@ -271,7 +271,7 @@ public String toString() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public boolean equals(Object obj) { @@ -283,7 +283,7 @@ public boolean equals(Object obj) { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public int hashCode() { diff --git a/api/src/main/java/com/intuit/tank/vm/vmManager/VMInformation.java b/api/src/main/java/com/intuit/tank/vm/vmManager/VMInformation.java index 0062bf333..763243b17 100644 --- a/api/src/main/java/com/intuit/tank/vm/vmManager/VMInformation.java +++ b/api/src/main/java/com/intuit/tank/vm/vmManager/VMInformation.java @@ -167,7 +167,7 @@ public VMRegion getRegion() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public String toString() { diff --git a/api/src/main/java/com/intuit/tank/vm/vmManager/VMInstanceRequest.java b/api/src/main/java/com/intuit/tank/vm/vmManager/VMInstanceRequest.java index eeb6f1d54..4078e0139 100644 --- a/api/src/main/java/com/intuit/tank/vm/vmManager/VMInstanceRequest.java +++ b/api/src/main/java/com/intuit/tank/vm/vmManager/VMInstanceRequest.java @@ -359,7 +359,7 @@ public String getReportingMode() { } /** - * @inheritDoc + * {@inheritDoc} */ @Override public String toString() { diff --git a/data_access/pom.xml b/data_access/pom.xml index 9c3f5dc57..ad0d61fcd 100644 --- a/data_access/pom.xml +++ b/data_access/pom.xml @@ -6,7 +6,7 @@ com.intuit.tank tank-parent - 3.0.2 + 3.1.0 diff --git a/data_access/src/main/java/com/intuit/tank/dao/DataFileDao.java b/data_access/src/main/java/com/intuit/tank/dao/DataFileDao.java index 1bee79b29..51f992c39 100644 --- a/data_access/src/main/java/com/intuit/tank/dao/DataFileDao.java +++ b/data_access/src/main/java/com/intuit/tank/dao/DataFileDao.java @@ -87,7 +87,7 @@ public DataFile storeDataFile(@Nonnull DataFile df, @Nullable InputStream is) { } // /** - // * @inheritDoc} + // * {@inheritDoc}} // * Don't want to delete files because we may be using a version of the datafile. // */ // @Override diff --git a/data_access/src/main/java/com/intuit/tank/dao/ScriptDao.java b/data_access/src/main/java/com/intuit/tank/dao/ScriptDao.java index 1bf6d705a..4a9906ea5 100644 --- a/data_access/src/main/java/com/intuit/tank/dao/ScriptDao.java +++ b/data_access/src/main/java/com/intuit/tank/dao/ScriptDao.java @@ -49,7 +49,7 @@ public class ScriptDao extends BaseDao