From cfe1166de5843a30eb512df254e1d83e31b402f9 Mon Sep 17 00:00:00 2001 From: Suman Nakshatri Date: Fri, 23 May 2025 11:27:36 -0400 Subject: [PATCH 1/4] SRE-35204: cleanup reporting module --- agent/apiharness/pom.xml | 5 + .../com/intuit/tank/harness/APIMonitor.java | 2 +- .../intuit/tank/harness/APITestHarness.java | 8 +- .../com/intuit/tank/harness/TPSMonitor.java | 4 +- .../intuit/tank/harness/TestPlanStarter.java | 2 +- .../tank/runner/method/RequestRunner.java | 2 +- .../intuit/tank/runner/method/TimerMap.java | 4 +- .../tank/runner/method/TimerRunner.java | 2 +- .../java/com/intuit/tank/common/TPSTest.java | 4 +- .../intuit/tank/harness/APIMonitorTest.java | 4 +- .../intuit/tank/harness/TPSMonitorTest.java | 5 +- .../tank/runner/method/TimerMapTest.java | 2 +- .../tank/reporting}/DummyResultsReader.java | 7 +- .../tank/reporting}/DummyResultsReporter.java | 5 +- .../tank/reporting}/PagedTimingResults.java | 4 +- .../tank/reporting}/ReportingFactory.java | 9 +- .../intuit/tank/reporting}/ResultsReader.java | 5 +- .../tank/reporting}/ResultsReporter.java | 5 +- .../tank/reporting}/TankResultBuilder.java | 4 +- .../reporting/models}/CreateTableMessage.java | 2 +- .../tank/reporting/models}/Namespace.java | 2 +- .../tank/reporting/models}/TPSInfo.java | 2 +- .../reporting/models}/TPSInfoContainer.java | 2 +- .../models}/TPSReportingPackage.java | 2 +- .../models}/TankAgentStatusResponse.java | 2 +- .../tank/reporting/models}/TankResult.java | 4 +- .../reporting/models}/TankResultPackage.java | 4 +- pom.xml | 3 - reporting/api/.gitignore | 1 - reporting/api/pom.xml | 27 - .../tank/reporting/databases/Attribute.java | 110 --- .../tank/reporting/databases/IDatabase.java | 131 ---- .../intuit/tank/reporting/databases/Item.java | 107 --- .../tank/reporting/databases/Monitor.java | 41 -- .../databases/PagedDatabaseResult.java | 58 -- .../reporting/databases/TankDatabaseType.java | 30 - .../api/src/main/resources/META-INF/beans.xml | 22 - .../com/intuit/tank/reporting/api/jaxb.index | 3 - .../reporting/api/TPSInfoContainerTest.java | 307 --------- .../tank/reporting/api/TPSInfoTest.java | 287 -------- .../reporting/databases/AttributeTest.java | 241 ------- .../reporting/databases/IDatabaseTest.java | 32 - .../tank/reporting/databases/ItemTest.java | 245 ------- .../tank/reporting/databases/MonitorTest.java | 30 - .../databases/PagedDatabaseResultTest.java | 84 --- .../databases/TankDatabaseTypeTest.java | 29 - .../tank/results/CreateTableMessageTest.java | 75 --- .../results/TankAgentStatusResponseTest.java | 120 ---- .../results/TankResultBuilderBaseTest.java | 177 ----- .../tank/results/TankResultBuilderTest.java | 84 --- .../intuit/tank/results/TankResultTest.java | 525 --------------- reporting/db/.gitignore | 1 - reporting/db/pom.xml | 53 -- .../databases/AmazonDynamoDatabaseDocApi.java | 636 ------------------ .../persistence/databases/BucketDataItem.java | 70 -- .../databases/CloudWatchDataSource.java | 175 ----- .../databases/DataBaseFactory.java | 46 -- .../persistence/databases/DatabaseKeys.java | 43 -- .../persistence/databases/DatabaseQueue.java | 39 -- .../databases/GraphiteDatasource.java | 200 ------ .../databases/MetricsCalculator.java | 189 ------ .../persistence/databases/S3Datasource.java | 214 ------ .../databases/WavefrontDatasource.java | 243 ------- .../reporting/db/DatabaseResultsReader.java | 198 ------ .../reporting/db/DatabaseResultsReporter.java | 150 ----- .../db/src/main/resources/META-INF/beans.xml | 22 - .../databases/AmazonDynamoDatabaseTest.java | 194 ------ .../databases/BucketDataItemTest.java | 118 ---- .../databases/DatabaseQueueTest.java | 75 --- .../databases/MetricsCalculatorTest.java | 86 --- reporting/local/pom.xml | 35 - .../tank/reporting/local/ResultsStorage.java | 142 ---- .../reporting/rest/RestResultsReader.java | 61 -- .../src/main/resources/META-INF/beans.xml | 22 - reporting/pom.xml | 37 - reporting/rest/pom.xml | 34 - .../reporting/rest/RestResultsReporter.java | 101 --- .../src/main/resources/META-INF/beans.xml | 22 - .../intuit/tank/project/JobTreeTableBean.java | 6 +- .../src/main/webapp/META-INF/context.xml | 13 + 80 files changed, 70 insertions(+), 6027 deletions(-) rename {reporting/api/src/main/java/com/intuit/tank/reporting/api => api/src/main/java/com/intuit/tank/reporting}/DummyResultsReader.java (87%) rename {reporting/api/src/main/java/com/intuit/tank/reporting/api => api/src/main/java/com/intuit/tank/reporting}/DummyResultsReporter.java (84%) rename {reporting/api/src/main/java/com/intuit/tank/reporting/api => api/src/main/java/com/intuit/tank/reporting}/PagedTimingResults.java (90%) rename {reporting/api/src/main/java/com/intuit/tank/reporting/factory => api/src/main/java/com/intuit/tank/reporting}/ReportingFactory.java (84%) rename {reporting/api/src/main/java/com/intuit/tank/reporting/api => api/src/main/java/com/intuit/tank/reporting}/ResultsReader.java (94%) rename {reporting/api/src/main/java/com/intuit/tank/reporting/api => api/src/main/java/com/intuit/tank/reporting}/ResultsReporter.java (90%) rename {reporting/api/src/main/java/com/intuit/tank/results => api/src/main/java/com/intuit/tank/reporting}/TankResultBuilder.java (96%) rename {reporting/api/src/main/java/com/intuit/tank/results => api/src/main/java/com/intuit/tank/reporting/models}/CreateTableMessage.java (94%) rename {reporting/api/src/main/java/com/intuit/tank/reporting/api => api/src/main/java/com/intuit/tank/reporting/models}/Namespace.java (93%) rename {reporting/api/src/main/java/com/intuit/tank/reporting/api => api/src/main/java/com/intuit/tank/reporting/models}/TPSInfo.java (98%) rename {reporting/api/src/main/java/com/intuit/tank/reporting/api => api/src/main/java/com/intuit/tank/reporting/models}/TPSInfoContainer.java (98%) rename {reporting/api/src/main/java/com/intuit/tank/reporting/api => api/src/main/java/com/intuit/tank/reporting/models}/TPSReportingPackage.java (98%) rename {reporting/api/src/main/java/com/intuit/tank/results => api/src/main/java/com/intuit/tank/reporting/models}/TankAgentStatusResponse.java (96%) rename {reporting/api/src/main/java/com/intuit/tank/results => api/src/main/java/com/intuit/tank/reporting/models}/TankResult.java (98%) rename {reporting/api/src/main/java/com/intuit/tank/results => api/src/main/java/com/intuit/tank/reporting/models}/TankResultPackage.java (96%) delete mode 100644 reporting/api/.gitignore delete mode 100644 reporting/api/pom.xml delete mode 100644 reporting/api/src/main/java/com/intuit/tank/reporting/databases/Attribute.java delete mode 100644 reporting/api/src/main/java/com/intuit/tank/reporting/databases/IDatabase.java delete mode 100644 reporting/api/src/main/java/com/intuit/tank/reporting/databases/Item.java delete mode 100644 reporting/api/src/main/java/com/intuit/tank/reporting/databases/Monitor.java delete mode 100644 reporting/api/src/main/java/com/intuit/tank/reporting/databases/PagedDatabaseResult.java delete mode 100644 reporting/api/src/main/java/com/intuit/tank/reporting/databases/TankDatabaseType.java delete mode 100644 reporting/api/src/main/resources/META-INF/beans.xml delete mode 100644 reporting/api/src/main/resources/com/intuit/tank/reporting/api/jaxb.index delete mode 100644 reporting/api/src/test/java/com/intuit/tank/reporting/api/TPSInfoContainerTest.java delete mode 100644 reporting/api/src/test/java/com/intuit/tank/reporting/api/TPSInfoTest.java delete mode 100644 reporting/api/src/test/java/com/intuit/tank/reporting/databases/AttributeTest.java delete mode 100644 reporting/api/src/test/java/com/intuit/tank/reporting/databases/IDatabaseTest.java delete mode 100644 reporting/api/src/test/java/com/intuit/tank/reporting/databases/ItemTest.java delete mode 100644 reporting/api/src/test/java/com/intuit/tank/reporting/databases/MonitorTest.java delete mode 100644 reporting/api/src/test/java/com/intuit/tank/reporting/databases/PagedDatabaseResultTest.java delete mode 100644 reporting/api/src/test/java/com/intuit/tank/reporting/databases/TankDatabaseTypeTest.java delete mode 100644 reporting/api/src/test/java/com/intuit/tank/results/CreateTableMessageTest.java delete mode 100644 reporting/api/src/test/java/com/intuit/tank/results/TankAgentStatusResponseTest.java delete mode 100644 reporting/api/src/test/java/com/intuit/tank/results/TankResultBuilderBaseTest.java delete mode 100644 reporting/api/src/test/java/com/intuit/tank/results/TankResultBuilderTest.java delete mode 100644 reporting/api/src/test/java/com/intuit/tank/results/TankResultTest.java delete mode 100644 reporting/db/.gitignore delete mode 100644 reporting/db/pom.xml delete mode 100644 reporting/db/src/main/java/com/intuit/tank/persistence/databases/AmazonDynamoDatabaseDocApi.java delete mode 100644 reporting/db/src/main/java/com/intuit/tank/persistence/databases/BucketDataItem.java delete mode 100644 reporting/db/src/main/java/com/intuit/tank/persistence/databases/CloudWatchDataSource.java delete mode 100644 reporting/db/src/main/java/com/intuit/tank/persistence/databases/DataBaseFactory.java delete mode 100644 reporting/db/src/main/java/com/intuit/tank/persistence/databases/DatabaseKeys.java delete mode 100644 reporting/db/src/main/java/com/intuit/tank/persistence/databases/DatabaseQueue.java delete mode 100644 reporting/db/src/main/java/com/intuit/tank/persistence/databases/GraphiteDatasource.java delete mode 100644 reporting/db/src/main/java/com/intuit/tank/persistence/databases/MetricsCalculator.java delete mode 100644 reporting/db/src/main/java/com/intuit/tank/persistence/databases/S3Datasource.java delete mode 100644 reporting/db/src/main/java/com/intuit/tank/persistence/databases/WavefrontDatasource.java delete mode 100644 reporting/db/src/main/java/com/intuit/tank/reporting/db/DatabaseResultsReader.java delete mode 100644 reporting/db/src/main/java/com/intuit/tank/reporting/db/DatabaseResultsReporter.java delete mode 100644 reporting/db/src/main/resources/META-INF/beans.xml delete mode 100644 reporting/db/src/test/java/com/intuit/tank/persistence/databases/AmazonDynamoDatabaseTest.java delete mode 100644 reporting/db/src/test/java/com/intuit/tank/persistence/databases/BucketDataItemTest.java delete mode 100644 reporting/db/src/test/java/com/intuit/tank/persistence/databases/DatabaseQueueTest.java delete mode 100644 reporting/db/src/test/java/com/intuit/tank/persistence/databases/MetricsCalculatorTest.java delete mode 100644 reporting/local/pom.xml delete mode 100644 reporting/local/src/main/java/com/intuit/tank/reporting/local/ResultsStorage.java delete mode 100644 reporting/local/src/main/java/com/intuit/tank/reporting/rest/RestResultsReader.java delete mode 100644 reporting/local/src/main/resources/META-INF/beans.xml delete mode 100644 reporting/pom.xml delete mode 100644 reporting/rest/pom.xml delete mode 100644 reporting/rest/src/main/java/com/intuit/tank/reporting/rest/RestResultsReporter.java delete mode 100644 reporting/rest/src/main/resources/META-INF/beans.xml diff --git a/agent/apiharness/pom.xml b/agent/apiharness/pom.xml index 815a91bc0..aa4b620fa 100644 --- a/agent/apiharness/pom.xml +++ b/agent/apiharness/pom.xml @@ -15,6 +15,11 @@ + + software.amazon.awssdk + cloudwatch + + ${project.groupId} script-engine diff --git a/agent/apiharness/src/main/java/com/intuit/tank/harness/APIMonitor.java b/agent/apiharness/src/main/java/com/intuit/tank/harness/APIMonitor.java index 804d76037..419fc4c9e 100644 --- a/agent/apiharness/src/main/java/com/intuit/tank/harness/APIMonitor.java +++ b/agent/apiharness/src/main/java/com/intuit/tank/harness/APIMonitor.java @@ -32,7 +32,7 @@ import com.intuit.tank.vm.vmManager.models.VMStatus; import com.intuit.tank.vm.vmManager.models.ValidationStatus; import com.intuit.tank.harness.logging.LogUtil; -import com.intuit.tank.reporting.api.TPSInfoContainer; +import com.intuit.tank.reporting.models.TPSInfoContainer; import com.intuit.tank.vm.agent.messages.WatsAgentStatusResponse; import com.intuit.tank.vm.api.enumerated.JobStatus; import com.intuit.tank.vm.api.enumerated.AgentCommand; 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 63a23092d..f1c9b297f 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 @@ -56,10 +56,10 @@ import com.intuit.tank.harness.logging.LogUtil; import com.intuit.tank.logging.LogEventType; import com.intuit.tank.logging.LoggingProfile; -import com.intuit.tank.reporting.api.DummyResultsReporter; -import com.intuit.tank.reporting.api.ResultsReporter; -import com.intuit.tank.reporting.factory.ReportingFactory; -import com.intuit.tank.results.TankResult; +import com.intuit.tank.reporting.DummyResultsReporter; +import com.intuit.tank.reporting.ReportingFactory; +import com.intuit.tank.reporting.ResultsReporter; +import com.intuit.tank.reporting.models.TankResult; import com.intuit.tank.vm.agent.messages.AgentData; import com.intuit.tank.vm.agent.messages.AgentTestStartData; import com.intuit.tank.vm.agent.messages.DataFileRequest; diff --git a/agent/apiharness/src/main/java/com/intuit/tank/harness/TPSMonitor.java b/agent/apiharness/src/main/java/com/intuit/tank/harness/TPSMonitor.java index e0cf52a03..c9680eef3 100644 --- a/agent/apiharness/src/main/java/com/intuit/tank/harness/TPSMonitor.java +++ b/agent/apiharness/src/main/java/com/intuit/tank/harness/TPSMonitor.java @@ -26,8 +26,8 @@ import org.apache.logging.log4j.Logger; import com.intuit.tank.http.BaseRequest; -import com.intuit.tank.reporting.api.TPSInfo; -import com.intuit.tank.reporting.api.TPSInfoContainer; +import com.intuit.tank.reporting.models.TPSInfo; +import com.intuit.tank.reporting.models.TPSInfoContainer; import com.intuit.tank.vm.settings.TimeUtil; public class TPSMonitor { 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 df884e384..46c53f0f2 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 @@ -14,7 +14,6 @@ */ import com.intuit.tank.harness.data.*; -import com.intuit.tank.reporting.api.TPSInfoContainer; import com.intuit.tank.runner.TestPlanRunner; import com.intuit.tank.vm.api.enumerated.IncrementStrategy; import org.apache.commons.lang3.time.DateUtils; @@ -23,6 +22,7 @@ import com.intuit.tank.harness.logging.LogUtil; import com.intuit.tank.logging.LogEventType; +import com.intuit.tank.reporting.models.TPSInfoContainer; import com.intuit.tank.vm.api.enumerated.AgentCommand; import software.amazon.awssdk.services.cloudwatch.CloudWatchAsyncClient; import software.amazon.awssdk.services.cloudwatch.model.Dimension; diff --git a/agent/apiharness/src/main/java/com/intuit/tank/runner/method/RequestRunner.java b/agent/apiharness/src/main/java/com/intuit/tank/runner/method/RequestRunner.java index b7bb24926..3ab1f9aa8 100644 --- a/agent/apiharness/src/main/java/com/intuit/tank/runner/method/RequestRunner.java +++ b/agent/apiharness/src/main/java/com/intuit/tank/runner/method/RequestRunner.java @@ -41,7 +41,7 @@ import com.intuit.tank.http.xml.XMLRequest; import com.intuit.tank.logging.LogEventType; import com.intuit.tank.logging.LoggingProfile; -import com.intuit.tank.results.TankResultBuilder; +import com.intuit.tank.reporting.TankResultBuilder; import com.intuit.tank.runner.ErrorContainer; import com.intuit.tank.runner.TestStepContext; import com.intuit.tank.script.RequestDataPhase; diff --git a/agent/apiharness/src/main/java/com/intuit/tank/runner/method/TimerMap.java b/agent/apiharness/src/main/java/com/intuit/tank/runner/method/TimerMap.java index ea1307359..c286c0444 100644 --- a/agent/apiharness/src/main/java/com/intuit/tank/runner/method/TimerMap.java +++ b/agent/apiharness/src/main/java/com/intuit/tank/runner/method/TimerMap.java @@ -17,8 +17,8 @@ import java.util.Map; import com.intuit.tank.harness.APITestHarness; -import com.intuit.tank.results.TankResult; -import com.intuit.tank.results.TankResultBuilder; +import com.intuit.tank.reporting.TankResultBuilder; +import com.intuit.tank.reporting.models.TankResult; public class TimerMap { private Map resultsMap = new HashMap(); diff --git a/agent/apiharness/src/main/java/com/intuit/tank/runner/method/TimerRunner.java b/agent/apiharness/src/main/java/com/intuit/tank/runner/method/TimerRunner.java index 99d5b5f97..0689944f6 100644 --- a/agent/apiharness/src/main/java/com/intuit/tank/runner/method/TimerRunner.java +++ b/agent/apiharness/src/main/java/com/intuit/tank/runner/method/TimerRunner.java @@ -17,7 +17,7 @@ import com.intuit.tank.harness.APITestHarness; import com.intuit.tank.harness.data.TimerStep; -import com.intuit.tank.results.TankResult; +import com.intuit.tank.reporting.models.TankResult; import com.intuit.tank.runner.TestStepContext; import com.intuit.tank.vm.common.TankConstants; diff --git a/agent/apiharness/src/test/java/com/intuit/tank/common/TPSTest.java b/agent/apiharness/src/test/java/com/intuit/tank/common/TPSTest.java index 1de5d83b6..a57db8395 100644 --- a/agent/apiharness/src/test/java/com/intuit/tank/common/TPSTest.java +++ b/agent/apiharness/src/test/java/com/intuit/tank/common/TPSTest.java @@ -24,10 +24,10 @@ import com.intuit.tank.persistence.databases.AmazonDynamoDatabaseDocApi; import com.intuit.tank.persistence.databases.DatabaseKeys; -import com.intuit.tank.reporting.api.TPSInfo; -import com.intuit.tank.reporting.api.TPSInfoContainer; import com.intuit.tank.reporting.databases.Attribute; import com.intuit.tank.reporting.databases.IDatabase; +import com.intuit.tank.reporting.models.TPSInfo; +import com.intuit.tank.reporting.models.TPSInfoContainer; import com.intuit.tank.test.TestGroups; import com.intuit.tank.vm.common.util.ReportUtil; import org.junit.jupiter.api.BeforeAll; diff --git a/agent/apiharness/src/test/java/com/intuit/tank/harness/APIMonitorTest.java b/agent/apiharness/src/test/java/com/intuit/tank/harness/APIMonitorTest.java index 796b08560..3984fdee0 100644 --- a/agent/apiharness/src/test/java/com/intuit/tank/harness/APIMonitorTest.java +++ b/agent/apiharness/src/test/java/com/intuit/tank/harness/APIMonitorTest.java @@ -2,8 +2,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectWriter; -import com.intuit.tank.reporting.api.ResultsReporter; -import com.intuit.tank.reporting.api.TPSInfoContainer; +import com.intuit.tank.reporting.ResultsReporter; +import com.intuit.tank.reporting.models.TPSInfoContainer; import com.intuit.tank.vm.api.enumerated.VMImageType; import com.intuit.tank.vm.api.enumerated.VMRegion; import com.intuit.tank.vm.settings.*; diff --git a/agent/apiharness/src/test/java/com/intuit/tank/harness/TPSMonitorTest.java b/agent/apiharness/src/test/java/com/intuit/tank/harness/TPSMonitorTest.java index 3848a9a7c..c907fdd97 100644 --- a/agent/apiharness/src/test/java/com/intuit/tank/harness/TPSMonitorTest.java +++ b/agent/apiharness/src/test/java/com/intuit/tank/harness/TPSMonitorTest.java @@ -19,9 +19,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import com.intuit.tank.http.BaseRequest; -import com.intuit.tank.reporting.api.TPSInfoContainer; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; +import com.intuit.tank.reporting.models.TPSInfoContainer; + import org.junit.jupiter.api.Test; /** diff --git a/agent/apiharness/src/test/java/com/intuit/tank/runner/method/TimerMapTest.java b/agent/apiharness/src/test/java/com/intuit/tank/runner/method/TimerMapTest.java index 66f3f63ba..dd5ba35f6 100644 --- a/agent/apiharness/src/test/java/com/intuit/tank/runner/method/TimerMapTest.java +++ b/agent/apiharness/src/test/java/com/intuit/tank/runner/method/TimerMapTest.java @@ -17,7 +17,7 @@ */ import org.junit.jupiter.api.Test; -import com.intuit.tank.results.TankResult; +import com.intuit.tank.reporting.models.TankResult; /** * The class TimerMapTest contains tests for the class {@link TimerMap}. diff --git a/reporting/api/src/main/java/com/intuit/tank/reporting/api/DummyResultsReader.java b/api/src/main/java/com/intuit/tank/reporting/DummyResultsReader.java similarity index 87% rename from reporting/api/src/main/java/com/intuit/tank/reporting/api/DummyResultsReader.java rename to api/src/main/java/com/intuit/tank/reporting/DummyResultsReader.java index 9390aaec1..808d97014 100644 --- a/reporting/api/src/main/java/com/intuit/tank/reporting/api/DummyResultsReader.java +++ b/api/src/main/java/com/intuit/tank/reporting/DummyResultsReader.java @@ -1,7 +1,7 @@ /** * Copyright 2011 Intuit Inc. All Rights Reserved */ -package com.intuit.tank.reporting.api; +package com.intuit.tank.reporting; import java.util.ArrayList; import java.util.Date; @@ -11,7 +11,10 @@ import org.apache.commons.configuration.HierarchicalConfiguration; -import com.intuit.tank.results.TankResult; +import com.intuit.tank.reporting.PagedTimingResults; +import com.intuit.tank.reporting.ResultsReader; +import com.intuit.tank.reporting.models.TPSInfo; +import com.intuit.tank.reporting.models.TankResult; /** * DummyResultsReader diff --git a/reporting/api/src/main/java/com/intuit/tank/reporting/api/DummyResultsReporter.java b/api/src/main/java/com/intuit/tank/reporting/DummyResultsReporter.java similarity index 84% rename from reporting/api/src/main/java/com/intuit/tank/reporting/api/DummyResultsReporter.java rename to api/src/main/java/com/intuit/tank/reporting/DummyResultsReporter.java index 66fb13361..72eb19bb7 100644 --- a/reporting/api/src/main/java/com/intuit/tank/reporting/api/DummyResultsReporter.java +++ b/api/src/main/java/com/intuit/tank/reporting/DummyResultsReporter.java @@ -1,13 +1,14 @@ /** * Copyright 2011 Intuit Inc. All Rights Reserved */ -package com.intuit.tank.reporting.api; +package com.intuit.tank.reporting; import java.util.List; import org.apache.commons.configuration.HierarchicalConfiguration; -import com.intuit.tank.results.TankResult; +import com.intuit.tank.reporting.models.TPSInfoContainer; +import com.intuit.tank.reporting.models.TankResult; /** * DummyResultsReporter diff --git a/reporting/api/src/main/java/com/intuit/tank/reporting/api/PagedTimingResults.java b/api/src/main/java/com/intuit/tank/reporting/PagedTimingResults.java similarity index 90% rename from reporting/api/src/main/java/com/intuit/tank/reporting/api/PagedTimingResults.java rename to api/src/main/java/com/intuit/tank/reporting/PagedTimingResults.java index b776219ee..bfd771786 100644 --- a/reporting/api/src/main/java/com/intuit/tank/reporting/api/PagedTimingResults.java +++ b/api/src/main/java/com/intuit/tank/reporting/PagedTimingResults.java @@ -1,9 +1,9 @@ -package com.intuit.tank.reporting.api; +package com.intuit.tank.reporting; import java.io.Serializable; import java.util.List; -import com.intuit.tank.results.TankResult; +import com.intuit.tank.reporting.models.TankResult; public class PagedTimingResults implements Serializable { diff --git a/reporting/api/src/main/java/com/intuit/tank/reporting/factory/ReportingFactory.java b/api/src/main/java/com/intuit/tank/reporting/ReportingFactory.java similarity index 84% rename from reporting/api/src/main/java/com/intuit/tank/reporting/factory/ReportingFactory.java rename to api/src/main/java/com/intuit/tank/reporting/ReportingFactory.java index 00e764962..fb15a8188 100644 --- a/reporting/api/src/main/java/com/intuit/tank/reporting/factory/ReportingFactory.java +++ b/api/src/main/java/com/intuit/tank/reporting/ReportingFactory.java @@ -1,12 +1,9 @@ -package com.intuit.tank.reporting.factory; +package com.intuit.tank.reporting; import org.apache.commons.configuration.HierarchicalConfiguration; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import com.intuit.tank.reporting.api.DummyResultsReporter; -import com.intuit.tank.reporting.api.ResultsReader; -import com.intuit.tank.reporting.api.ResultsReporter; import com.intuit.tank.vm.settings.ReportingConfig; import com.intuit.tank.vm.settings.TankConfig; @@ -27,7 +24,7 @@ public static final ResultsReporter getResultsReporter() { try { ReportingConfig config = new TankConfig().getReportingConfig(); String providerClass = config.getReporterClass(); - ret = (ResultsReporter) Class.forName(providerClass).newInstance(); + ret = (ResultsReporter) Class.forName(providerClass).getDeclaredConstructor().newInstance(); HierarchicalConfiguration providerConfig = config.getProviderConfig(); ret.config(providerConfig); } catch (Exception e) { @@ -45,7 +42,7 @@ public static final ResultsReader getResultsReader() { try { ReportingConfig config = new TankConfig().getReportingConfig(); String providerClass = config.getReaderClass(); - ret = (ResultsReader) Class.forName(providerClass).newInstance(); + ret = (ResultsReader) Class.forName(providerClass).getDeclaredConstructor().newInstance(); HierarchicalConfiguration providerConfig = config.getProviderConfig(); ret.config(providerConfig); } catch (Exception e) { diff --git a/reporting/api/src/main/java/com/intuit/tank/reporting/api/ResultsReader.java b/api/src/main/java/com/intuit/tank/reporting/ResultsReader.java similarity index 94% rename from reporting/api/src/main/java/com/intuit/tank/reporting/api/ResultsReader.java rename to api/src/main/java/com/intuit/tank/reporting/ResultsReader.java index f1c26b866..5d1a26d9e 100644 --- a/reporting/api/src/main/java/com/intuit/tank/reporting/api/ResultsReader.java +++ b/api/src/main/java/com/intuit/tank/reporting/ResultsReader.java @@ -1,4 +1,4 @@ -package com.intuit.tank.reporting.api; +package com.intuit.tank.reporting; import java.util.Date; import java.util.List; @@ -8,7 +8,8 @@ import org.apache.commons.configuration.HierarchicalConfiguration; -import com.intuit.tank.results.TankResult; +import com.intuit.tank.reporting.models.TPSInfo; +import com.intuit.tank.reporting.models.TankResult; public interface ResultsReader { diff --git a/reporting/api/src/main/java/com/intuit/tank/reporting/api/ResultsReporter.java b/api/src/main/java/com/intuit/tank/reporting/ResultsReporter.java similarity index 90% rename from reporting/api/src/main/java/com/intuit/tank/reporting/api/ResultsReporter.java rename to api/src/main/java/com/intuit/tank/reporting/ResultsReporter.java index aa8465a96..607afb072 100644 --- a/reporting/api/src/main/java/com/intuit/tank/reporting/api/ResultsReporter.java +++ b/api/src/main/java/com/intuit/tank/reporting/ResultsReporter.java @@ -1,10 +1,11 @@ -package com.intuit.tank.reporting.api; +package com.intuit.tank.reporting; import java.util.List; import org.apache.commons.configuration.HierarchicalConfiguration; -import com.intuit.tank.results.TankResult; +import com.intuit.tank.reporting.models.TPSInfoContainer; +import com.intuit.tank.reporting.models.TankResult; /** * diff --git a/reporting/api/src/main/java/com/intuit/tank/results/TankResultBuilder.java b/api/src/main/java/com/intuit/tank/reporting/TankResultBuilder.java similarity index 96% rename from reporting/api/src/main/java/com/intuit/tank/results/TankResultBuilder.java rename to api/src/main/java/com/intuit/tank/reporting/TankResultBuilder.java index ece052918..1079a828b 100644 --- a/reporting/api/src/main/java/com/intuit/tank/results/TankResultBuilder.java +++ b/api/src/main/java/com/intuit/tank/reporting/TankResultBuilder.java @@ -5,10 +5,12 @@ * See generator home page at: http://code.google.com/p/fluent-builders-generator-eclipse-plugin/ */ -package com.intuit.tank.results; +package com.intuit.tank.reporting; import java.util.Date; +import com.intuit.tank.reporting.models.TankResult; + /* * #%L * Reporting API diff --git a/reporting/api/src/main/java/com/intuit/tank/results/CreateTableMessage.java b/api/src/main/java/com/intuit/tank/reporting/models/CreateTableMessage.java similarity index 94% rename from reporting/api/src/main/java/com/intuit/tank/results/CreateTableMessage.java rename to api/src/main/java/com/intuit/tank/reporting/models/CreateTableMessage.java index 2c5aa59a6..e071977c2 100644 --- a/reporting/api/src/main/java/com/intuit/tank/results/CreateTableMessage.java +++ b/api/src/main/java/com/intuit/tank/reporting/models/CreateTableMessage.java @@ -1,4 +1,4 @@ -package com.intuit.tank.results; +package com.intuit.tank.reporting.models; /* * #%L diff --git a/reporting/api/src/main/java/com/intuit/tank/reporting/api/Namespace.java b/api/src/main/java/com/intuit/tank/reporting/models/Namespace.java similarity index 93% rename from reporting/api/src/main/java/com/intuit/tank/reporting/api/Namespace.java rename to api/src/main/java/com/intuit/tank/reporting/models/Namespace.java index b8e7c92ca..656ba1fdd 100644 --- a/reporting/api/src/main/java/com/intuit/tank/reporting/api/Namespace.java +++ b/api/src/main/java/com/intuit/tank/reporting/models/Namespace.java @@ -1,7 +1,7 @@ /** * Copyright 2011 Intuit Inc. All Rights Reserved */ -package com.intuit.tank.reporting.api; +package com.intuit.tank.reporting.models; /* * #%L diff --git a/reporting/api/src/main/java/com/intuit/tank/reporting/api/TPSInfo.java b/api/src/main/java/com/intuit/tank/reporting/models/TPSInfo.java similarity index 98% rename from reporting/api/src/main/java/com/intuit/tank/reporting/api/TPSInfo.java rename to api/src/main/java/com/intuit/tank/reporting/models/TPSInfo.java index 6dd42fc08..40dbad847 100644 --- a/reporting/api/src/main/java/com/intuit/tank/reporting/api/TPSInfo.java +++ b/api/src/main/java/com/intuit/tank/reporting/models/TPSInfo.java @@ -1,7 +1,7 @@ /** * Copyright 2013 Intuit Inc. All Rights Reserved */ -package com.intuit.tank.reporting.api; +package com.intuit.tank.reporting.models; /* * #%L diff --git a/reporting/api/src/main/java/com/intuit/tank/reporting/api/TPSInfoContainer.java b/api/src/main/java/com/intuit/tank/reporting/models/TPSInfoContainer.java similarity index 98% rename from reporting/api/src/main/java/com/intuit/tank/reporting/api/TPSInfoContainer.java rename to api/src/main/java/com/intuit/tank/reporting/models/TPSInfoContainer.java index ab1d65725..c836b0ccc 100644 --- a/reporting/api/src/main/java/com/intuit/tank/reporting/api/TPSInfoContainer.java +++ b/api/src/main/java/com/intuit/tank/reporting/models/TPSInfoContainer.java @@ -1,7 +1,7 @@ /** * Copyright 2011 Intuit Inc. All Rights Reserved */ -package com.intuit.tank.reporting.api; +package com.intuit.tank.reporting.models; /* * #%L diff --git a/reporting/api/src/main/java/com/intuit/tank/reporting/api/TPSReportingPackage.java b/api/src/main/java/com/intuit/tank/reporting/models/TPSReportingPackage.java similarity index 98% rename from reporting/api/src/main/java/com/intuit/tank/reporting/api/TPSReportingPackage.java rename to api/src/main/java/com/intuit/tank/reporting/models/TPSReportingPackage.java index 6686c6065..cf4cea97f 100644 --- a/reporting/api/src/main/java/com/intuit/tank/reporting/api/TPSReportingPackage.java +++ b/api/src/main/java/com/intuit/tank/reporting/models/TPSReportingPackage.java @@ -1,7 +1,7 @@ /** * Copyright 2011 Intuit Inc. All Rights Reserved */ -package com.intuit.tank.reporting.api; +package com.intuit.tank.reporting.models; /* * #%L diff --git a/reporting/api/src/main/java/com/intuit/tank/results/TankAgentStatusResponse.java b/api/src/main/java/com/intuit/tank/reporting/models/TankAgentStatusResponse.java similarity index 96% rename from reporting/api/src/main/java/com/intuit/tank/results/TankAgentStatusResponse.java rename to api/src/main/java/com/intuit/tank/reporting/models/TankAgentStatusResponse.java index 40a6da231..f9c26d512 100644 --- a/reporting/api/src/main/java/com/intuit/tank/results/TankAgentStatusResponse.java +++ b/api/src/main/java/com/intuit/tank/reporting/models/TankAgentStatusResponse.java @@ -1,4 +1,4 @@ -package com.intuit.tank.results; +package com.intuit.tank.reporting.models; /* * #%L diff --git a/reporting/api/src/main/java/com/intuit/tank/results/TankResult.java b/api/src/main/java/com/intuit/tank/reporting/models/TankResult.java similarity index 98% rename from reporting/api/src/main/java/com/intuit/tank/results/TankResult.java rename to api/src/main/java/com/intuit/tank/reporting/models/TankResult.java index 68725064d..bd949e01a 100644 --- a/reporting/api/src/main/java/com/intuit/tank/results/TankResult.java +++ b/api/src/main/java/com/intuit/tank/reporting/models/TankResult.java @@ -1,4 +1,4 @@ -package com.intuit.tank.results; +package com.intuit.tank.reporting.models; /* * #%L @@ -24,8 +24,6 @@ import org.apache.commons.lang3.builder.ToStringBuilder; -import com.intuit.tank.reporting.api.Namespace; - /** * WatsResult represents a result to log or store to database. * diff --git a/reporting/api/src/main/java/com/intuit/tank/results/TankResultPackage.java b/api/src/main/java/com/intuit/tank/reporting/models/TankResultPackage.java similarity index 96% rename from reporting/api/src/main/java/com/intuit/tank/results/TankResultPackage.java rename to api/src/main/java/com/intuit/tank/reporting/models/TankResultPackage.java index 80759f07e..e25c6c78c 100644 --- a/reporting/api/src/main/java/com/intuit/tank/results/TankResultPackage.java +++ b/api/src/main/java/com/intuit/tank/reporting/models/TankResultPackage.java @@ -1,7 +1,7 @@ /** * Copyright 2011 Intuit Inc. All Rights Reserved */ -package com.intuit.tank.results; +package com.intuit.tank.reporting.models; /* * #%L @@ -27,8 +27,6 @@ import jakarta.xml.bind.annotation.XmlRootElement; import jakarta.xml.bind.annotation.XmlType; -import com.intuit.tank.reporting.api.Namespace; - /** * TankResultPackage * diff --git a/pom.xml b/pom.xml index d6791999a..fc0bc5cf9 100644 --- a/pom.xml +++ b/pom.xml @@ -93,7 +93,6 @@ script_processor harness_data search - reporting test_support api data_model @@ -188,7 +187,6 @@ tank_common harness_data search - reporting test_support api data_model @@ -214,7 +212,6 @@ tank_common harness_data search - reporting test_support api data_model diff --git a/reporting/api/.gitignore b/reporting/api/.gitignore deleted file mode 100644 index ea8c4bf7f..000000000 --- a/reporting/api/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/target diff --git a/reporting/api/pom.xml b/reporting/api/pom.xml deleted file mode 100644 index 08483e5b0..000000000 --- a/reporting/api/pom.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - 4.0.0 - - - com.intuit.tank - reporting-parent - 4.1.1-SNAPSHOT - - - reporting-api - - jar - Reporting API - - - - - ${project.groupId} - api - ${project.version} - - - - - diff --git a/reporting/api/src/main/java/com/intuit/tank/reporting/databases/Attribute.java b/reporting/api/src/main/java/com/intuit/tank/reporting/databases/Attribute.java deleted file mode 100644 index c9a5f0c7b..000000000 --- a/reporting/api/src/main/java/com/intuit/tank/reporting/databases/Attribute.java +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Copyright 2011 Intuit Inc. All Rights Reserved - */ -package com.intuit.tank.reporting.databases; - -/* - * #%L - * Reporting API - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -import java.io.Serializable; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; - -/** - * Attribute - * - * @author dangleton - * - */ -public class Attribute implements Serializable { - - private static final long serialVersionUID = 1L; - private String name; - private String value; - - /** - * - */ - public Attribute() { - super(); - } - - /** - * @param name - * @param value - */ - public Attribute(String name, String value) { - super(); - this.name = name; - this.value = value; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name - * the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the value - */ - public String getValue() { - return value; - } - - /** - * @param value - * the value to set - */ - public void setValue(String value) { - this.value = value; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return name + " = " + value; - } - - /** - * {@inheritDoc} - */ - @Override - public int hashCode() { - return new HashCodeBuilder(13, 49).append(name).append(value).toHashCode(); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean equals(Object obj) { - if (obj != null && obj instanceof Attribute) { - Attribute o = (Attribute) obj; - return new EqualsBuilder().append(name, o.name).append(value, o.value).isEquals(); - } - return false; - } -} diff --git a/reporting/api/src/main/java/com/intuit/tank/reporting/databases/IDatabase.java b/reporting/api/src/main/java/com/intuit/tank/reporting/databases/IDatabase.java deleted file mode 100644 index fdd9d1611..000000000 --- a/reporting/api/src/main/java/com/intuit/tank/reporting/databases/IDatabase.java +++ /dev/null @@ -1,131 +0,0 @@ -package com.intuit.tank.reporting.databases; - -/* - * #%L - * Reporting API - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -import java.util.List; -import java.util.Set; - -import jakarta.annotation.Nonnull; - -import com.intuit.tank.results.TankResult; - -public interface IDatabase { - - /** - * Creates the table if needed no-op if table already exists. - * - * @param tableName - * the name of the table this db instance is dealing with - */ - public void initNamespace(@Nonnull String tableName); - - /** - * Deletes the table from the datastore. - * - * @param tableName - * the name of the table this db instance is dealing with - */ - public void removeNamespace(@Nonnull String tableName); - - /** - * Deletes the table from the datastore. - * - * @param tableName - * the name of the table this db instance is dealing with - */ - public void deleteForJob(@Nonnull String tableName, @Nonnull String jobId, boolean asynch); - - /** - * Test if the table exists in the datastore. - * - * @param tableName - * the name of the table this db instance is dealing with - * @return true if the table exists - */ - public boolean hasTable(@Nonnull String tableName); - - /** - * Test if the table exists in the datastore. - * - * @param tableName - * the name of the table this db instance is dealing with - * @return true if the table exists - */ - public boolean hasJobData(@Nonnull String tableName, String jobId); - - /** - * Adds the results to the datastore in batch mode. - * - * @param tableName - * the name of the table this db instance is dealing with - * @param results - * the results to add - * @param asynch - * whether this method should execute asynchronously - */ - public void addTimingResults(@Nonnull String tableName, @Nonnull List results, boolean asynch); - - /** - * Gets all the domains that match the given regex. - * - * @param match - * a regular expression to match the domain name - * @return the list of domains that match the given regex - */ - public Set getTables(String regex); - - /** - * - * @param tableName - * @param items - */ - public void addItems(String tableName, List items, boolean asynch); - - /** - * Gets all the items in the range. - * - * @param tableName - * the table to fetch items from - * @param jobId - * the jobId of the items - * @param minRange - * the minRange as a String in format DATE_FORMAT - * @param maxRange - * the maxRange as a String in format DATE_FORMAT - * @return - */ - @Nonnull - public List getItems(String tableName, String minRange, String maxRange, String instanceId, String... jobId); - - /** - * - * @param tableName - * @param jobId - * @param nextToken - * @param minRange - * @param maxRange - * @return - */ - public PagedDatabaseResult getPagedItems(String tableName, Object nextToken, String minRange, - String maxRange, String instanceId, String jobId); - - /** - * - * @param type - * @param jobId - * @return - */ - public String getDatabaseName(TankDatabaseType type, String jobId); - -} diff --git a/reporting/api/src/main/java/com/intuit/tank/reporting/databases/Item.java b/reporting/api/src/main/java/com/intuit/tank/reporting/databases/Item.java deleted file mode 100644 index acc5d2295..000000000 --- a/reporting/api/src/main/java/com/intuit/tank/reporting/databases/Item.java +++ /dev/null @@ -1,107 +0,0 @@ -/** - * Copyright 2011 Intuit Inc. All Rights Reserved - */ -package com.intuit.tank.reporting.databases; - -/* - * #%L - * Reporting API - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -import java.io.Serializable; -import java.util.List; - -/** - * Item - * - * @author dangleton - * - */ - -public class Item implements Serializable { - private static final long serialVersionUID = 1L; - private String name; - private List attributes; - - /** - * @param name - * @param attributes - */ - public Item(String name, List attributes) { - super(); - this.name = name; - this.attributes = attributes; - } - - /** - * - */ - public Item() { - super(); - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name - * the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the attributes - */ - public List getAttributes() { - return attributes; - } - - /** - * @param attributes - * the attributes to set - */ - public void setAttributes(List attributes) { - this.attributes = attributes; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return name; - } - - /** - * {@inheritDoc} - */ - @Override - public int hashCode() { - return name.hashCode(); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean equals(Object obj) { - if (obj != null && obj instanceof Item) { - return name.equals(((Item) obj).name); - } - return false; - } -} diff --git a/reporting/api/src/main/java/com/intuit/tank/reporting/databases/Monitor.java b/reporting/api/src/main/java/com/intuit/tank/reporting/databases/Monitor.java deleted file mode 100644 index acbd23439..000000000 --- a/reporting/api/src/main/java/com/intuit/tank/reporting/databases/Monitor.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright 2011 Intuit Inc. All Rights Reserved - */ -package com.intuit.tank.reporting.databases; - -/* - * #%L - * Reporting API - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -import com.intuit.tank.results.TankAgentStatusResponse; -import com.intuit.tank.results.TankResult; - -/** - * Monitor - * - * @author dangleton - * - */ -public interface Monitor { - - /** - * - * @param result - */ - public void recordResult(TankResult result); - - /** - * - * @param result - */ - public void recordStatus(TankAgentStatusResponse result); -} diff --git a/reporting/api/src/main/java/com/intuit/tank/reporting/databases/PagedDatabaseResult.java b/reporting/api/src/main/java/com/intuit/tank/reporting/databases/PagedDatabaseResult.java deleted file mode 100644 index e8611bb0d..000000000 --- a/reporting/api/src/main/java/com/intuit/tank/reporting/databases/PagedDatabaseResult.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Copyright 2011 Intuit Inc. All Rights Reserved - */ -package com.intuit.tank.reporting.databases; - -/* - * #%L - * Reporting API - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -import java.io.Serializable; -import java.util.List; - -/** - * PagedDatabaseResult - * - * @author dangleton - * - */ -public class PagedDatabaseResult implements Serializable { - - private static final long serialVersionUID = 1L; - private List items; - private Object nextToken; - - /** - * @param items - * @param nextToken - */ - public PagedDatabaseResult(List items, Object nextToken) { - super(); - this.items = items; - this.nextToken = nextToken; - } - - /** - * @return the items - */ - public List getItems() { - return items; - } - - /** - * @return the nextToken - */ - public Object getNextToken() { - return nextToken; - } - -} diff --git a/reporting/api/src/main/java/com/intuit/tank/reporting/databases/TankDatabaseType.java b/reporting/api/src/main/java/com/intuit/tank/reporting/databases/TankDatabaseType.java deleted file mode 100644 index d4fefce72..000000000 --- a/reporting/api/src/main/java/com/intuit/tank/reporting/databases/TankDatabaseType.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright 2011 Intuit Inc. All Rights Reserved - */ -package com.intuit.tank.reporting.databases; - -/* - * #%L - * Reporting API - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -/** - * TankDatabaseType - * - * @author dangleton - * - */ -public enum TankDatabaseType { - - timing, - timing_summary, - periodic_timing -} diff --git a/reporting/api/src/main/resources/META-INF/beans.xml b/reporting/api/src/main/resources/META-INF/beans.xml deleted file mode 100644 index 13e26c380..000000000 --- a/reporting/api/src/main/resources/META-INF/beans.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - diff --git a/reporting/api/src/main/resources/com/intuit/tank/reporting/api/jaxb.index b/reporting/api/src/main/resources/com/intuit/tank/reporting/api/jaxb.index deleted file mode 100644 index 28bbb184b..000000000 --- a/reporting/api/src/main/resources/com/intuit/tank/reporting/api/jaxb.index +++ /dev/null @@ -1,3 +0,0 @@ -TPSInfo -TPSInfoContainer -TPSReportingPackage \ No newline at end of file diff --git a/reporting/api/src/test/java/com/intuit/tank/reporting/api/TPSInfoContainerTest.java b/reporting/api/src/test/java/com/intuit/tank/reporting/api/TPSInfoContainerTest.java deleted file mode 100644 index d180f1708..000000000 --- a/reporting/api/src/test/java/com/intuit/tank/reporting/api/TPSInfoContainerTest.java +++ /dev/null @@ -1,307 +0,0 @@ -package com.intuit.tank.reporting.api; - -/* - * #%L - * Cloud Rest API - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -import java.util.Date; -import java.util.LinkedList; -import java.util.List; - -import org.junit.jupiter.api.Test; - -/** - * The class TPSInfoContainerTest contains tests for the class {@link TPSInfoContainer}. - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ -public class TPSInfoContainerTest { - /** - * Run the TPSInfoContainer() constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ - @Test - public void testTPSInfoContainer_1() - throws Exception { - - TPSInfoContainer result = new TPSInfoContainer(); - - assertNotNull(result); - assertEquals(0, result.getPeriod()); - assertEquals(null, result.getMaxTime()); - assertEquals(null, result.getMinTime()); - assertEquals(0, result.getTotalTps()); - } - - /** - * Run the TPSInfoContainer(Date,Date,int,List) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ - @Test - public void testTPSInfoContainer_2() - throws Exception { - Date minTime = new Date(); - Date maxTime = new Date(); - int period = 1; - List tpsInfos = new LinkedList(); - - TPSInfoContainer result = new TPSInfoContainer(minTime, maxTime, period, tpsInfos); - - assertNotNull(result); - assertEquals(1, result.getPeriod()); - assertEquals(0, result.getTotalTps()); - } - - /** - * Run the TPSInfoContainer(Date,Date,int,List) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ - @Test - public void testTPSInfoContainer_3() - throws Exception { - Date minTime = new Date(); - Date maxTime = new Date(); - int period = 1; - List tpsInfos = new LinkedList(); - - TPSInfoContainer result = new TPSInfoContainer(minTime, maxTime, period, tpsInfos); - - assertNotNull(result); - assertEquals(1, result.getPeriod()); - assertEquals(0, result.getTotalTps()); - } - - /** - * Run the TPSInfoContainer(Date,Date,int,List) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ - @Test - public void testTPSInfoContainer_4() - throws Exception { - Date minTime = new Date(); - Date maxTime = new Date(); - int period = 1; - List tpsInfos = new LinkedList(); - - TPSInfoContainer result = new TPSInfoContainer(minTime, maxTime, period, tpsInfos); - - assertNotNull(result); - assertEquals(1, result.getPeriod()); - assertEquals(0, result.getTotalTps()); - } - - /** - * Run the TPSInfoContainer(Date,Date,int,List) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ - @Test - public void testTPSInfoContainer_5() - throws Exception { - Date minTime = new Date(); - Date maxTime = new Date(); - int period = 1; - List tpsInfos = new LinkedList(); - - TPSInfoContainer result = new TPSInfoContainer(minTime, maxTime, period, tpsInfos); - - assertNotNull(result); - assertEquals(1, result.getPeriod()); - assertEquals(0, result.getTotalTps()); - } - - /** - * Run the TPSInfoContainer(Date,Date,int,List) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ - @Test - public void testTPSInfoContainer_6() - throws Exception { - Date minTime = new Date(); - Date maxTime = new Date(); - int period = 1; - List tpsInfos = new LinkedList(); - - TPSInfoContainer result = new TPSInfoContainer(minTime, maxTime, period, tpsInfos); - - assertNotNull(result); - assertEquals(1, result.getPeriod()); - assertEquals(0, result.getTotalTps()); - } - - /** - * Run the TPSInfoContainer(Date,Date,int,List) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ - @Test - public void testTPSInfoContainer_7() - throws Exception { - Date minTime = new Date(); - Date maxTime = new Date(); - int period = 1; - List tpsInfos = new LinkedList(); - - TPSInfoContainer result = new TPSInfoContainer(minTime, maxTime, period, tpsInfos); - - assertNotNull(result); - assertEquals(1, result.getPeriod()); - assertEquals(0, result.getTotalTps()); - } - - /** - * Run the TPSInfoContainer(Date,Date,int,List) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ - @Test - public void testTPSInfoContainer_8() - throws Exception { - Date minTime = new Date(); - Date maxTime = new Date(); - int period = 1; - List tpsInfos = null; - - TPSInfoContainer result = new TPSInfoContainer(minTime, maxTime, period, tpsInfos); - - assertNotNull(result); - assertEquals(1, result.getPeriod()); - assertEquals(null, result.getTpsInfos()); - assertEquals(0, result.getTotalTps()); - } - - /** - * Run the Date getMaxTime() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ - @Test - public void testGetMaxTime_1() - throws Exception { - TPSInfoContainer fixture = new TPSInfoContainer(new Date(), new Date(), 1, new LinkedList()); - - Date result = fixture.getMaxTime(); - - assertNotNull(result); - } - - /** - * Run the Date getMinTime() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ - @Test - public void testGetMinTime_1() - throws Exception { - TPSInfoContainer fixture = new TPSInfoContainer(new Date(), new Date(), 1, new LinkedList()); - - Date result = fixture.getMinTime(); - - assertNotNull(result); - } - - /** - * Run the int getPeriod() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ - @Test - public void testGetPeriod_1() - throws Exception { - TPSInfoContainer fixture = new TPSInfoContainer(new Date(), new Date(), 1, new LinkedList()); - - int result = fixture.getPeriod(); - - assertEquals(1, result); - } - - /** - * Run the int getTotalTps() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ - @Test - public void testGetTotalTps_1() - throws Exception { - TPSInfoContainer fixture = new TPSInfoContainer(new Date(), new Date(), 1, new LinkedList()); - - int result = fixture.getTotalTps(); - - assertEquals(0, result); - } - - /** - * Run the List getTpsInfos() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ - @Test - public void testGetTpsInfos_1() - throws Exception { - TPSInfoContainer fixture = new TPSInfoContainer(new Date(), new Date(), 1, new LinkedList()); - - List result = fixture.getTpsInfos(); - - assertNotNull(result); - assertEquals(0, result.size()); - } - - /** - * Run the String toString() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ - @Test - public void testToString_1() - throws Exception { - TPSInfoContainer fixture = new TPSInfoContainer(new Date(), new Date(), 1, new LinkedList()); - - String result = fixture.toString(); - - } -} \ No newline at end of file diff --git a/reporting/api/src/test/java/com/intuit/tank/reporting/api/TPSInfoTest.java b/reporting/api/src/test/java/com/intuit/tank/reporting/api/TPSInfoTest.java deleted file mode 100644 index c0ee75d65..000000000 --- a/reporting/api/src/test/java/com/intuit/tank/reporting/api/TPSInfoTest.java +++ /dev/null @@ -1,287 +0,0 @@ -package com.intuit.tank.reporting.api; - -/* - * #%L - * Cloud Rest API - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -import java.text.DateFormat; -import java.util.Date; - -import org.junit.jupiter.api.*; - -import com.intuit.tank.reporting.api.TPSInfo; - -import static org.junit.jupiter.api.Assertions.*; - -/** - * The class TPSInfoTest contains tests for the class {@link TPSInfo}. - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ -public class TPSInfoTest { - /** - * Run the TPSInfo() constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ - @Test - public void testTPSInfo_1() - throws Exception { - - TPSInfo result = new TPSInfo(); - - assertNotNull(result); - assertEquals(null, result.getTimestamp()); - assertEquals(null, result.getKey()); - assertEquals(0, result.getTPS()); - assertEquals(0, result.getPeriodInSeconds()); - assertEquals(0, result.getTransactions()); - } - - /** - * Run the TPSInfo(Date,String,int,int) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ - @Test - public void testTPSInfo_2() - throws Exception { - Date timestamp = new Date(); - String key = ""; - int transactions = 1; - int period = 1; - - TPSInfo result = new TPSInfo(timestamp, key, transactions, period); - - assertNotNull(result); - assertEquals("", result.getKey()); - assertEquals(1, result.getTPS()); - assertEquals(1, result.getPeriodInSeconds()); - assertEquals(1, result.getTransactions()); - } - - /** - * Run the TPSInfo add(TPSInfo) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ - @Test - public void testAdd_1() - throws Exception { - TPSInfo fixture = new TPSInfo(new Date(), "", 1, 1); - TPSInfo toAdd = new TPSInfo(new Date(), "", 1, 1); - - TPSInfo result = fixture.add(toAdd); - - assertNotNull(result); - assertEquals("", result.getKey()); - assertEquals(2, result.getTPS()); - assertEquals(1, result.getPeriodInSeconds()); - assertEquals(2, result.getTransactions()); - } - - /** - * Run the boolean equals(Object) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ - @Test - public void testEquals_1() - throws Exception { - TPSInfo fixture = new TPSInfo(new Date(), "", 1, 1); - Object obj = new Object(); - - boolean result = fixture.equals(obj); - - assertEquals(false, result); - } - - /** - * Run the boolean equals(Object) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ - @Test - public void testEquals_2() - throws Exception { - Date date = new Date(); - TPSInfo fixture = new TPSInfo(date, "", 1, 1); - Object obj = new TPSInfo(date, "", 1, 1); - - boolean result = fixture.equals(obj); - - assertEquals(true, result); - } - - /** - * Run the boolean equals(Object) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ - @Test - public void testEquals_3() - throws Exception { - Date date = new Date(); - TPSInfo fixture = new TPSInfo(date, "", 1, 1); - Object obj = new TPSInfo(date, "", 1, 1); - - boolean result = fixture.equals(obj); - - assertEquals(true, result); - } - - /** - * Run the String getKey() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ - @Test - public void testGetKey_1() - throws Exception { - TPSInfo fixture = new TPSInfo(new Date(), "", 1, 1); - - String result = fixture.getKey(); - - assertEquals("", result); - } - - /** - * Run the int getPeriodInSeconds() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ - @Test - public void testGetPeriodInSeconds_1() - throws Exception { - TPSInfo fixture = new TPSInfo(new Date(), "", 1, 1); - - int result = fixture.getPeriodInSeconds(); - - assertEquals(1, result); - } - - /** - * Run the int getTPS() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ - @Test - public void testGetTPS_1() - throws Exception { - TPSInfo fixture = new TPSInfo(new Date(), "", 1, 1); - - int result = fixture.getTPS(); - - assertEquals(1, result); - } - - /** - * Run the int getTPS() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ - @Test - public void testGetTPS_2() - throws Exception { - TPSInfo fixture = new TPSInfo(new Date(), "", 1, 0); - - int result = fixture.getTPS(); - - assertEquals(0, result); - } - - /** - * Run the Date getTimestamp() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ - @Test - public void testGetTimestamp_1() - throws Exception { - TPSInfo fixture = new TPSInfo(new Date(), "", 1, 1); - - Date result = fixture.getTimestamp(); - - assertNotNull(result); - } - - /** - * Run the int getTransactions() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ - @Test - public void testGetTransactions_1() - throws Exception { - TPSInfo fixture = new TPSInfo(new Date(), "", 1, 1); - - int result = fixture.getTransactions(); - - assertEquals(1, result); - } - - /** - * Run the int hashCode() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ - @Test - public void testHashCode_1() - throws Exception { - TPSInfo fixture = new TPSInfo(new Date(), "", 1, 1); - - int result = fixture.hashCode(); - - } - - /** - * Run the String toString() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 12/15/14 2:57 PM - */ - @Test - public void testToString_1() - throws Exception { - TPSInfo fixture = new TPSInfo(new Date(), "", 1, 1); - - String result = fixture.toString(); - - } -} \ No newline at end of file diff --git a/reporting/api/src/test/java/com/intuit/tank/reporting/databases/AttributeTest.java b/reporting/api/src/test/java/com/intuit/tank/reporting/databases/AttributeTest.java deleted file mode 100644 index 1483db3c7..000000000 --- a/reporting/api/src/test/java/com/intuit/tank/reporting/databases/AttributeTest.java +++ /dev/null @@ -1,241 +0,0 @@ -package com.intuit.tank.reporting.databases; - -/* - * #%L - * Reporting API - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -import org.junit.jupiter.api.*; - -import com.intuit.tank.reporting.databases.Attribute; - -import static org.junit.jupiter.api.Assertions.*; - -/** - * The class AttributeTest contains tests for the class {@link Attribute}. - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ -public class AttributeTest { - /** - * Run the Attribute() constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ - @Test - public void testAttribute_1() - throws Exception { - - Attribute result = new Attribute(); - - assertNotNull(result); - assertEquals("null = null", result.toString()); - assertEquals(null, result.getName()); - assertEquals(null, result.getValue()); - } - - /** - * Run the Attribute(String,String) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ - @Test - public void testAttribute_2() - throws Exception { - String name = ""; - String value = ""; - - Attribute result = new Attribute(name, value); - - assertNotNull(result); - assertEquals(" = ", result.toString()); - assertEquals("", result.getName()); - assertEquals("", result.getValue()); - } - - /** - * Run the boolean equals(Object) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ - @Test - public void testEquals_1() - throws Exception { - Attribute fixture = new Attribute("", ""); - Object obj = new Attribute("", ""); - - boolean result = fixture.equals(obj); - - assertEquals(true, result); - } - - /** - * Run the boolean equals(Object) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ - @Test - public void testEquals_2() - throws Exception { - Attribute fixture = new Attribute("", ""); - Object obj = new Attribute("", ""); - - boolean result = fixture.equals(obj); - - assertEquals(true, result); - } - - /** - * Run the boolean equals(Object) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ - @Test - public void testEquals_3() - throws Exception { - Attribute fixture = new Attribute("", ""); - Object obj = null; - - boolean result = fixture.equals(obj); - - assertEquals(false, result); - } - - /** - * Run the boolean equals(Object) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ - @Test - public void testEquals_4() - throws Exception { - Attribute fixture = new Attribute("", ""); - Object obj = new Object(); - - boolean result = fixture.equals(obj); - - assertEquals(false, result); - } - - /** - * Run the String getName() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ - @Test - public void testGetName_1() - throws Exception { - Attribute fixture = new Attribute("", ""); - - String result = fixture.getName(); - - assertEquals("", result); - } - - /** - * Run the String getValue() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ - @Test - public void testGetValue_1() - throws Exception { - Attribute fixture = new Attribute("", ""); - - String result = fixture.getValue(); - - assertEquals("", result); - } - - /** - * Run the int hashCode() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ - @Test - public void testHashCode_1() - throws Exception { - Attribute fixture = new Attribute("", ""); - - int result = fixture.hashCode(); - - assertEquals(31213, result); - } - - /** - * Run the void setName(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ - @Test - public void testSetName_1() - throws Exception { - Attribute fixture = new Attribute("", ""); - String name = ""; - - fixture.setName(name); - - } - - /** - * Run the void setValue(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ - @Test - public void testSetValue_1() - throws Exception { - Attribute fixture = new Attribute("", ""); - String value = ""; - - fixture.setValue(value); - - } - - /** - * Run the String toString() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ - @Test - public void testToString_1() - throws Exception { - Attribute fixture = new Attribute("", ""); - - String result = fixture.toString(); - - assertEquals(" = ", result); - } -} \ No newline at end of file diff --git a/reporting/api/src/test/java/com/intuit/tank/reporting/databases/IDatabaseTest.java b/reporting/api/src/test/java/com/intuit/tank/reporting/databases/IDatabaseTest.java deleted file mode 100644 index 3afafb103..000000000 --- a/reporting/api/src/test/java/com/intuit/tank/reporting/databases/IDatabaseTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.intuit.tank.reporting.databases; - -/* - * #%L - * Reporting API - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -import java.util.List; -import java.util.Set; - -import org.junit.jupiter.api.*; - -import static org.junit.jupiter.api.Assertions.*; - -import com.intuit.tank.reporting.databases.IDatabase; -import com.intuit.tank.results.TankResult; - -/** - * The class IDatabaseTest contains tests for the class {@link IDatabase}. - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ -public class IDatabaseTest { -} \ No newline at end of file diff --git a/reporting/api/src/test/java/com/intuit/tank/reporting/databases/ItemTest.java b/reporting/api/src/test/java/com/intuit/tank/reporting/databases/ItemTest.java deleted file mode 100644 index 12211b602..000000000 --- a/reporting/api/src/test/java/com/intuit/tank/reporting/databases/ItemTest.java +++ /dev/null @@ -1,245 +0,0 @@ -package com.intuit.tank.reporting.databases; - -/* - * #%L - * Reporting API - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -import java.util.LinkedList; -import java.util.List; - -import org.junit.jupiter.api.*; - -import com.intuit.tank.reporting.databases.Attribute; -import com.intuit.tank.reporting.databases.Item; - -import static org.junit.jupiter.api.Assertions.*; - -/** - * The class ItemTest contains tests for the class {@link Item}. - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ -public class ItemTest { - /** - * Run the Item() constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ - @Test - public void testItem_1() - throws Exception { - - Item result = new Item(); - - assertNotNull(result); - assertEquals(null, result.toString()); - assertEquals(null, result.getName()); - assertEquals(null, result.getAttributes()); - } - - /** - * Run the Item(String,List) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ - @Test - public void testItem_2() - throws Exception { - String name = ""; - List attributes = new LinkedList(); - - Item result = new Item(name, attributes); - - assertNotNull(result); - assertEquals("", result.toString()); - assertEquals("", result.getName()); - } - - /** - * Run the boolean equals(Object) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ - @Test - public void testEquals_1() - throws Exception { - Item fixture = new Item("", new LinkedList()); - Object obj = new Item("", new LinkedList()); - - boolean result = fixture.equals(obj); - - assertEquals(true, result); - } - - /** - * Run the boolean equals(Object) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ - @Test - public void testEquals_2() - throws Exception { - Item fixture = new Item("", new LinkedList()); - Object obj = new Item("", new LinkedList()); - - boolean result = fixture.equals(obj); - - assertEquals(true, result); - } - - /** - * Run the boolean equals(Object) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ - @Test - public void testEquals_3() - throws Exception { - Item fixture = new Item("", new LinkedList()); - Object obj = null; - - boolean result = fixture.equals(obj); - - assertEquals(false, result); - } - - /** - * Run the boolean equals(Object) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ - @Test - public void testEquals_4() - throws Exception { - Item fixture = new Item("", new LinkedList()); - Object obj = new Object(); - - boolean result = fixture.equals(obj); - - assertEquals(false, result); - } - - /** - * Run the List getAttributes() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ - @Test - public void testGetAttributes_1() - throws Exception { - Item fixture = new Item("", new LinkedList()); - - List result = fixture.getAttributes(); - - assertNotNull(result); - assertEquals(0, result.size()); - } - - /** - * Run the String getName() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ - @Test - public void testGetName_1() - throws Exception { - Item fixture = new Item("", new LinkedList()); - - String result = fixture.getName(); - - assertEquals("", result); - } - - /** - * Run the int hashCode() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ - @Test - public void testHashCode_1() - throws Exception { - Item fixture = new Item("", new LinkedList()); - - int result = fixture.hashCode(); - - assertEquals(0, result); - } - - /** - * Run the void setAttributes(List) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ - @Test - public void testSetAttributes_1() - throws Exception { - Item fixture = new Item("", new LinkedList()); - List attributes = new LinkedList(); - - fixture.setAttributes(attributes); - - } - - /** - * Run the void setName(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ - @Test - public void testSetName_1() - throws Exception { - Item fixture = new Item("", new LinkedList()); - String name = ""; - - fixture.setName(name); - - } - - /** - * Run the String toString() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ - @Test - public void testToString_1() - throws Exception { - Item fixture = new Item("", new LinkedList()); - - String result = fixture.toString(); - - assertEquals("", result); - } -} \ No newline at end of file diff --git a/reporting/api/src/test/java/com/intuit/tank/reporting/databases/MonitorTest.java b/reporting/api/src/test/java/com/intuit/tank/reporting/databases/MonitorTest.java deleted file mode 100644 index 4ce9c7b9c..000000000 --- a/reporting/api/src/test/java/com/intuit/tank/reporting/databases/MonitorTest.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.intuit.tank.reporting.databases; - -/* - * #%L - * Reporting API - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -import org.junit.jupiter.api.*; - -import static org.junit.jupiter.api.Assertions.*; - -import com.intuit.tank.reporting.databases.Monitor; -import com.intuit.tank.results.TankAgentStatusResponse; -import com.intuit.tank.results.TankResult; - -/** - * The class MonitorTest contains tests for the class {@link Monitor}. - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ -public class MonitorTest { -} \ No newline at end of file diff --git a/reporting/api/src/test/java/com/intuit/tank/reporting/databases/PagedDatabaseResultTest.java b/reporting/api/src/test/java/com/intuit/tank/reporting/databases/PagedDatabaseResultTest.java deleted file mode 100644 index 9ff4b24a9..000000000 --- a/reporting/api/src/test/java/com/intuit/tank/reporting/databases/PagedDatabaseResultTest.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.intuit.tank.reporting.databases; - -/* - * #%L - * Reporting API - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -import java.util.LinkedList; -import java.util.List; - -import org.junit.jupiter.api.*; - -import com.intuit.tank.reporting.databases.Item; -import com.intuit.tank.reporting.databases.PagedDatabaseResult; - -import static org.junit.jupiter.api.Assertions.*; - -/** - * The class PagedDatabaseResultTest contains tests for the class {@link PagedDatabaseResult}. - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ -public class PagedDatabaseResultTest { - /** - * Run the PagedDatabaseResult(List,Object) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ - @Test - public void testPagedDatabaseResult_1() - throws Exception { - List items = new LinkedList(); - Object nextToken = new Object(); - - PagedDatabaseResult result = new PagedDatabaseResult(items, nextToken); - - assertNotNull(result); - } - - /** - * Run the List getItems() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ - @Test - public void testGetItems_1() - throws Exception { - PagedDatabaseResult fixture = new PagedDatabaseResult(new LinkedList(), new Object()); - - List result = fixture.getItems(); - - assertNotNull(result); - assertEquals(0, result.size()); - } - - /** - * Run the Object getNextToken() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ - @Test - public void testGetNextToken_1() - throws Exception { - PagedDatabaseResult fixture = new PagedDatabaseResult(new LinkedList(), new Object()); - - Object result = fixture.getNextToken(); - - assertNotNull(result); - } -} \ No newline at end of file diff --git a/reporting/api/src/test/java/com/intuit/tank/reporting/databases/TankDatabaseTypeTest.java b/reporting/api/src/test/java/com/intuit/tank/reporting/databases/TankDatabaseTypeTest.java deleted file mode 100644 index d710e4dd9..000000000 --- a/reporting/api/src/test/java/com/intuit/tank/reporting/databases/TankDatabaseTypeTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.intuit.tank.reporting.databases; - -/* - * #%L - * Reporting API - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -import org.junit.jupiter.api.*; - -import com.intuit.tank.reporting.databases.TankDatabaseType; - -import static org.junit.jupiter.api.Assertions.*; - -/** - * The class TankDatabaseTypeTest contains tests for the class - * {@link TankDatabaseType}. - * - * @generatedBy CodePro at 9/10/14 10:30 AM - */ -public class TankDatabaseTypeTest { -} \ No newline at end of file diff --git a/reporting/api/src/test/java/com/intuit/tank/results/CreateTableMessageTest.java b/reporting/api/src/test/java/com/intuit/tank/results/CreateTableMessageTest.java deleted file mode 100644 index fca210196..000000000 --- a/reporting/api/src/test/java/com/intuit/tank/results/CreateTableMessageTest.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.intuit.tank.results; - -/* - * #%L - * Reporting API - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -import org.junit.jupiter.api.*; - -import com.intuit.tank.results.CreateTableMessage; - -import static org.junit.jupiter.api.Assertions.*; - -/** - * The class CreateTableMessageTest contains tests for the class {@link CreateTableMessage}. - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ -public class CreateTableMessageTest { - /** - * Run the CreateTableMessage() constructor test. - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testCreateTableMessage_1() - throws Exception { - CreateTableMessage result = new CreateTableMessage(); - assertNotNull(result); - } - - /** - * Run the String getTableName() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testGetTableName_1() - throws Exception { - CreateTableMessage fixture = new CreateTableMessage(); - fixture.setTableName(""); - - String result = fixture.getTableName(); - - assertEquals("", result); - } - - /** - * Run the void setTableName(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testSetTableName_1() - throws Exception { - CreateTableMessage fixture = new CreateTableMessage(); - fixture.setTableName(""); - String tableName = ""; - - fixture.setTableName(tableName); - - } -} \ No newline at end of file diff --git a/reporting/api/src/test/java/com/intuit/tank/results/TankAgentStatusResponseTest.java b/reporting/api/src/test/java/com/intuit/tank/results/TankAgentStatusResponseTest.java deleted file mode 100644 index 1cfbf4c08..000000000 --- a/reporting/api/src/test/java/com/intuit/tank/results/TankAgentStatusResponseTest.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.intuit.tank.results; - -/* - * #%L - * Reporting API - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -import org.junit.jupiter.api.*; - -import com.intuit.tank.results.TankAgentStatusResponse; - -import static org.junit.jupiter.api.Assertions.*; - -/** - * The class TankAgentStatusResponseTest contains tests for the class - * {@link TankAgentStatusResponse}. - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ -public class TankAgentStatusResponseTest { - /** - * Run the TankAgentStatusResponse(long,int,int,int) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testTankAgentStatusResponse_1() - throws Exception { - long time = 1L; - int num = 1; - int max = 1; - int ramp = 1; - - TankAgentStatusResponse result = new TankAgentStatusResponse(time, num, max, ramp); - - assertNotNull(result); - assertEquals(1, result.getMaxVirtualUsers()); - assertEquals(1L, result.getRunTime()); - assertEquals(1, result.getCurrentNumberUsers()); - assertEquals(1, result.getRampTimeLeft()); - } - - /** - * Run the int getCurrentNumberUsers() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testGetCurrentNumberUsers_1() - throws Exception { - TankAgentStatusResponse fixture = new TankAgentStatusResponse(1L, 1, 1, 1); - - int result = fixture.getCurrentNumberUsers(); - - assertEquals(1, result); - } - - /** - * Run the int getMaxVirtualUsers() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testGetMaxVirtualUsers_1() - throws Exception { - TankAgentStatusResponse fixture = new TankAgentStatusResponse(1L, 1, 1, 1); - - int result = fixture.getMaxVirtualUsers(); - - assertEquals(1, result); - } - - /** - * Run the int getRampTimeLeft() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testGetRampTimeLeft_1() - throws Exception { - TankAgentStatusResponse fixture = new TankAgentStatusResponse(1L, 1, 1, 1); - - int result = fixture.getRampTimeLeft(); - - assertEquals(1, result); - } - - /** - * Run the long getRunTime() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testGetRunTime_1() - throws Exception { - TankAgentStatusResponse fixture = new TankAgentStatusResponse(1L, 1, 1, 1); - - long result = fixture.getRunTime(); - - assertEquals(1L, result); - } -} \ No newline at end of file diff --git a/reporting/api/src/test/java/com/intuit/tank/results/TankResultBuilderBaseTest.java b/reporting/api/src/test/java/com/intuit/tank/results/TankResultBuilderBaseTest.java deleted file mode 100644 index e529e8fc0..000000000 --- a/reporting/api/src/test/java/com/intuit/tank/results/TankResultBuilderBaseTest.java +++ /dev/null @@ -1,177 +0,0 @@ -package com.intuit.tank.results; - -/* - * #%L - * Reporting API - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -import org.junit.jupiter.api.*; - -import com.intuit.tank.results.TankResult; -import com.intuit.tank.results.TankResultBuilderBase; - -import static org.junit.jupiter.api.Assertions.*; - -/** - * The class TankResultBuilderBaseTest contains tests for the class - * {@link TankResultBuilderBase}. - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ -public class TankResultBuilderBaseTest { - /** - * Run the TankResultBuilderBase(TankResult) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testTankResultBuilderBase_1() - throws Exception { - TankResult aInstance = new TankResult(); - - TankResultBuilderBase result = new TankResultBuilderBase(aInstance); - - assertNotNull(result); - } - - /** - * Run the TankResult getInstance() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testGetInstance_1() - throws Exception { - TankResultBuilderBase fixture = new TankResultBuilderBase(new TankResult()); - - TankResult result = fixture.getInstance(); - - assertNotNull(result); - assertEquals(false, result.isError()); - assertEquals(null, result.getJobId()); - assertEquals(0, result.getResponseTime()); - assertEquals(0, result.getResponseSize()); - assertEquals(null, result.getRequestName()); - assertEquals(0, result.getStatusCode()); - } - - /** - * Run the TankResultBuilderBase withError(boolean) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testWithError_1() - throws Exception { - TankResultBuilderBase fixture = new TankResultBuilderBase(new TankResult()); - boolean aValue = true; - - TankResultBuilderBase result = fixture.withError(aValue); - - assertNotNull(result); - } - - /** - * Run the TankResultBuilderBase withJobId(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testWithJobId_1() - throws Exception { - TankResultBuilderBase fixture = new TankResultBuilderBase(new TankResult()); - String aValue = ""; - - TankResultBuilderBase result = fixture.withJobId(aValue); - - assertNotNull(result); - } - - /** - * Run the TankResultBuilderBase withRequestName(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testWithRequestName_1() - throws Exception { - TankResultBuilderBase fixture = new TankResultBuilderBase(new TankResult()); - String aValue = ""; - - TankResultBuilderBase result = fixture.withRequestName(aValue); - - assertNotNull(result); - } - - /** - * Run the TankResultBuilderBase withResponseSize(int) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testWithResponseSize_1() - throws Exception { - TankResultBuilderBase fixture = new TankResultBuilderBase(new TankResult()); - int aValue = 1; - - TankResultBuilderBase result = fixture.withResponseSize(aValue); - - assertNotNull(result); - } - - /** - * Run the TankResultBuilderBase withResponseTime(int) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testWithResponseTime_1() - throws Exception { - TankResultBuilderBase fixture = new TankResultBuilderBase(new TankResult()); - int aValue = 1; - - TankResultBuilderBase result = fixture.withResponseTime(aValue); - - assertNotNull(result); - } - - /** - * Run the TankResultBuilderBase withStatusCode(int) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testWithStatusCode_1() - throws Exception { - TankResultBuilderBase fixture = new TankResultBuilderBase(new TankResult()); - int aValue = 1; - - TankResultBuilderBase result = fixture.withStatusCode(aValue); - - assertNotNull(result); - } -} \ No newline at end of file diff --git a/reporting/api/src/test/java/com/intuit/tank/results/TankResultBuilderTest.java b/reporting/api/src/test/java/com/intuit/tank/results/TankResultBuilderTest.java deleted file mode 100644 index 2c09bab8f..000000000 --- a/reporting/api/src/test/java/com/intuit/tank/results/TankResultBuilderTest.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.intuit.tank.results; - -/* - * #%L - * Reporting API - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -import org.junit.jupiter.api.*; - -import com.intuit.tank.results.TankResult; -import com.intuit.tank.results.TankResultBuilder; - -import static org.junit.jupiter.api.Assertions.*; - -/** - * The class TankResultBuilderTest contains tests for the class - * {@link TankResultBuilder}. - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ -public class TankResultBuilderTest { - /** - * Run the TankResultBuilder() constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testTankResultBuilder_1() - throws Exception { - - TankResultBuilder result = new TankResultBuilder(); - - assertNotNull(result); - } - - /** - * Run the TankResult build() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testBuild_1() - throws Exception { - TankResultBuilder fixture = new TankResultBuilder(); - - TankResult result = fixture.build(); - - assertNotNull(result); - assertEquals(false, result.isError()); - assertEquals(null, result.getJobId()); - assertEquals(0, result.getResponseTime()); - assertEquals(0, result.getResponseSize()); - assertEquals(null, result.getRequestName()); - assertEquals(0, result.getStatusCode()); - } - - /** - * Run the TankResultBuilder TankResult() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testTankResult_1() - throws Exception { - - TankResultBuilder result = TankResultBuilder.tankResult(); - - assertNotNull(result); - } -} \ No newline at end of file diff --git a/reporting/api/src/test/java/com/intuit/tank/results/TankResultTest.java b/reporting/api/src/test/java/com/intuit/tank/results/TankResultTest.java deleted file mode 100644 index f5ccc7ad1..000000000 --- a/reporting/api/src/test/java/com/intuit/tank/results/TankResultTest.java +++ /dev/null @@ -1,525 +0,0 @@ -package com.intuit.tank.results; - -/* - * #%L - * Reporting API - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -import java.text.DateFormat; -import java.util.Date; - -import org.junit.jupiter.api.*; - -import com.intuit.tank.results.TankResult; - -import static org.junit.jupiter.api.Assertions.*; - -/** - * The class TankResultTest contains tests for the class {@link TankResult}. - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ -public class TankResultTest { - /** - * Run the TankResult() constructor test. - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testTankResult_1() - throws Exception { - TankResult result = new TankResult(); - assertNotNull(result); - } - - /** - * Run the void add(TankResult) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testAdd_1() - throws Exception { - TankResult fixture = new TankResult(); - fixture.setError(true); - fixture.setResponseSize(1); - fixture.setResponseTime(1); - fixture.setJobId(""); - fixture.setTimeStamp(new Date()); - fixture.setStatusCode(0); - fixture.setRequestName(""); - TankResult result = new TankResult(); - result.setError(true); - - fixture.add(result); - - } - - /** - * Run the void add(TankResult) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testAdd_2() - throws Exception { - TankResult fixture = new TankResult(); - fixture.setError(true); - fixture.setResponseSize(1); - fixture.setResponseTime(1); - fixture.setJobId(""); - fixture.setTimeStamp(new Date()); - fixture.setStatusCode(1); - fixture.setRequestName(""); - TankResult result = new TankResult(); - result.setError(true); - - fixture.add(result); - - } - - /** - * Run the void add(TankResult) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testAdd_3() - throws Exception { - TankResult fixture = new TankResult(); - fixture.setError(false); - fixture.setResponseSize(1); - fixture.setResponseTime(1); - fixture.setJobId(""); - fixture.setTimeStamp(new Date()); - fixture.setStatusCode(0); - fixture.setRequestName(""); - TankResult result = new TankResult(); - result.setError(false); - - fixture.add(result); - - } - - /** - * Run the void add(TankResult) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testAdd_4() - throws Exception { - TankResult fixture = new TankResult(); - fixture.setError(false); - fixture.setResponseSize(1); - fixture.setResponseTime(1); - fixture.setJobId(""); - fixture.setTimeStamp(new Date()); - fixture.setStatusCode(1); - fixture.setRequestName(""); - TankResult result = new TankResult(); - result.setError(false); - - fixture.add(result); - - } - - /** - * Run the String getJobId() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testGetJobId_1() - throws Exception { - TankResult fixture = new TankResult(); - fixture.setError(true); - fixture.setResponseSize(1); - fixture.setResponseTime(1); - fixture.setJobId(""); - fixture.setTimeStamp(new Date()); - fixture.setStatusCode(1); - fixture.setRequestName(""); - - String result = fixture.getJobId(); - - assertEquals("", result); - } - - /** - * Run the String getRequestName() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testGetRequestName_1() - throws Exception { - TankResult fixture = new TankResult(); - fixture.setError(true); - fixture.setResponseSize(1); - fixture.setResponseTime(1); - fixture.setJobId(""); - fixture.setTimeStamp(new Date()); - fixture.setStatusCode(1); - fixture.setRequestName(""); - - String result = fixture.getRequestName(); - - assertEquals("", result); - } - - /** - * Run the int getResponseSize() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testGetResponseSize_1() - throws Exception { - TankResult fixture = new TankResult(); - fixture.setError(true); - fixture.setResponseSize(1); - fixture.setResponseTime(1); - fixture.setJobId(""); - fixture.setTimeStamp(new Date()); - fixture.setStatusCode(1); - fixture.setRequestName(""); - - int result = fixture.getResponseSize(); - - assertEquals(1, result); - } - - /** - * Run the int getResponseTime() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testGetResponseTime_1() - throws Exception { - TankResult fixture = new TankResult(); - fixture.setError(true); - fixture.setResponseSize(1); - fixture.setResponseTime(1); - fixture.setJobId(""); - fixture.setTimeStamp(new Date()); - fixture.setStatusCode(1); - fixture.setRequestName(""); - - int result = fixture.getResponseTime(); - - assertEquals(1, result); - } - - /** - * Run the int getStatusCode() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testGetStatusCode_1() - throws Exception { - TankResult fixture = new TankResult(); - fixture.setError(true); - fixture.setResponseSize(1); - fixture.setResponseTime(1); - fixture.setJobId(""); - fixture.setTimeStamp(new Date()); - fixture.setStatusCode(1); - fixture.setRequestName(""); - - int result = fixture.getStatusCode(); - - assertEquals(1, result); - } - - /** - * Run the Date getTimeStamp() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testGetTimeStamp_1() - throws Exception { - TankResult fixture = new TankResult(); - fixture.setError(true); - fixture.setResponseSize(1); - fixture.setResponseTime(1); - fixture.setJobId(""); - fixture.setTimeStamp(new Date()); - fixture.setStatusCode(1); - fixture.setRequestName(""); - - Date result = fixture.getTimeStamp(); - - assertNotNull(result); - } - - /** - * Run the boolean isError() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testIsError_1() - throws Exception { - TankResult fixture = new TankResult(); - fixture.setError(true); - fixture.setResponseSize(1); - fixture.setResponseTime(1); - fixture.setJobId(""); - fixture.setTimeStamp(new Date()); - fixture.setStatusCode(1); - fixture.setRequestName(""); - - boolean result = fixture.isError(); - - assertEquals(true, result); - } - - /** - * Run the boolean isError() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testIsError_2() - throws Exception { - TankResult fixture = new TankResult(); - fixture.setError(false); - fixture.setResponseSize(1); - fixture.setResponseTime(1); - fixture.setJobId(""); - fixture.setTimeStamp(new Date()); - fixture.setStatusCode(1); - fixture.setRequestName(""); - - boolean result = fixture.isError(); - - assertEquals(false, result); - } - - /** - * Run the void setError(boolean) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testSetError_1() - throws Exception { - TankResult fixture = new TankResult(); - fixture.setError(true); - fixture.setResponseSize(1); - fixture.setResponseTime(1); - fixture.setJobId(""); - fixture.setTimeStamp(new Date()); - fixture.setStatusCode(1); - fixture.setRequestName(""); - boolean error = true; - - fixture.setError(error); - - } - - /** - * Run the void setJobId(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testSetJobId_1() - throws Exception { - TankResult fixture = new TankResult(); - fixture.setError(true); - fixture.setResponseSize(1); - fixture.setResponseTime(1); - fixture.setJobId(""); - fixture.setTimeStamp(new Date()); - fixture.setStatusCode(1); - fixture.setRequestName(""); - String jobId = ""; - - fixture.setJobId(jobId); - - } - - /** - * Run the void setRequestName(String) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testSetRequestName_1() - throws Exception { - TankResult fixture = new TankResult(); - fixture.setError(true); - fixture.setResponseSize(1); - fixture.setResponseTime(1); - fixture.setJobId(""); - fixture.setTimeStamp(new Date()); - fixture.setStatusCode(1); - fixture.setRequestName(""); - String requestName = ""; - - fixture.setRequestName(requestName); - - } - - /** - * Run the void setResponseSize(int) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testSetResponseSize_1() - throws Exception { - TankResult fixture = new TankResult(); - fixture.setError(true); - fixture.setResponseSize(1); - fixture.setResponseTime(1); - fixture.setJobId(""); - fixture.setTimeStamp(new Date()); - fixture.setStatusCode(1); - fixture.setRequestName(""); - int responseSize = 1; - - fixture.setResponseSize(responseSize); - - } - - /** - * Run the void setResponseTime(int) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testSetResponseTime_1() - throws Exception { - TankResult fixture = new TankResult(); - fixture.setError(true); - fixture.setResponseSize(1); - fixture.setResponseTime(1); - fixture.setJobId(""); - fixture.setTimeStamp(new Date()); - fixture.setStatusCode(1); - fixture.setRequestName(""); - int connectionTime = 1; - - fixture.setResponseTime(connectionTime); - - } - - /** - * Run the void setStatusCode(int) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testSetStatusCode_1() - throws Exception { - TankResult fixture = new TankResult(); - fixture.setError(true); - fixture.setResponseSize(1); - fixture.setResponseTime(1); - fixture.setJobId(""); - fixture.setTimeStamp(new Date()); - fixture.setStatusCode(1); - fixture.setRequestName(""); - int statusCode = 1; - - fixture.setStatusCode(statusCode); - - } - - /** - * Run the void setTimeStamp(Date) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testSetTimeStamp_1() - throws Exception { - TankResult fixture = new TankResult(); - fixture.setError(true); - fixture.setResponseSize(1); - fixture.setResponseTime(1); - fixture.setJobId(""); - fixture.setTimeStamp(new Date()); - fixture.setStatusCode(1); - fixture.setRequestName(""); - Date timeStamp = new Date(); - - fixture.setTimeStamp(timeStamp); - - } - - /** - * Run the String toString() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:31 AM - */ - @Test - public void testToString_1() - throws Exception { - TankResult fixture = new TankResult(); - fixture.setError(true); - fixture.setResponseSize(1); - fixture.setResponseTime(1); - fixture.setJobId(""); - fixture.setTimeStamp(new Date()); - fixture.setStatusCode(1); - fixture.setRequestName(""); - - String result = fixture.toString(); - - } -} \ No newline at end of file diff --git a/reporting/db/.gitignore b/reporting/db/.gitignore deleted file mode 100644 index ea8c4bf7f..000000000 --- a/reporting/db/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/target diff --git a/reporting/db/pom.xml b/reporting/db/pom.xml deleted file mode 100644 index 3f4a88166..000000000 --- a/reporting/db/pom.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - 4.0.0 - - - com.intuit.tank - reporting-parent - 4.1.1-SNAPSHOT - - - reporting-db - - jar - Reporting database support - - - - ${project.groupId} - api - ${project.version} - - - - ${project.groupId} - reporting-api - ${project.version} - - - - software.amazon.awssdk - dynamodb - - - - software.amazon.awssdk - cloudwatch - - - - com.opencsv - opencsv - - - - org.apache.commons - commons-math3 - - - - - - diff --git a/reporting/db/src/main/java/com/intuit/tank/persistence/databases/AmazonDynamoDatabaseDocApi.java b/reporting/db/src/main/java/com/intuit/tank/persistence/databases/AmazonDynamoDatabaseDocApi.java deleted file mode 100644 index 98473dbd0..000000000 --- a/reporting/db/src/main/java/com/intuit/tank/persistence/databases/AmazonDynamoDatabaseDocApi.java +++ /dev/null @@ -1,636 +0,0 @@ -package com.intuit.tank.persistence.databases; - -/* - * #%L - * Reporting database support - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.Executors; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; - -import jakarta.annotation.Nonnull; - -import org.apache.commons.configuration.HierarchicalConfiguration; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.math.NumberUtils; -import org.apache.http.HttpStatus; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import com.intuit.tank.reporting.databases.Attribute; -import com.intuit.tank.reporting.databases.IDatabase; -import com.intuit.tank.reporting.databases.Item; -import com.intuit.tank.reporting.databases.PagedDatabaseResult; -import com.intuit.tank.reporting.databases.TankDatabaseType; -import com.intuit.tank.results.TankResult; -import com.intuit.tank.vm.common.util.MethodTimer; -import com.intuit.tank.vm.common.util.ReportUtil; -import com.intuit.tank.vm.settings.CloudCredentials; -import com.intuit.tank.vm.settings.CloudProvider; -import com.intuit.tank.vm.settings.TankConfig; -import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; -import software.amazon.awssdk.auth.credentials.AwsCredentials; -import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; -import software.amazon.awssdk.awscore.exception.AwsServiceException; -import software.amazon.awssdk.services.dynamodb.DynamoDbClient; -import software.amazon.awssdk.services.dynamodb.model.AttributeDefinition; -import software.amazon.awssdk.services.dynamodb.model.AttributeValue; -import software.amazon.awssdk.services.dynamodb.model.BatchWriteItemRequest; -import software.amazon.awssdk.services.dynamodb.model.BatchWriteItemResponse; -import software.amazon.awssdk.services.dynamodb.model.ComparisonOperator; -import software.amazon.awssdk.services.dynamodb.model.Condition; -import software.amazon.awssdk.services.dynamodb.model.ConsumedCapacity; -import software.amazon.awssdk.services.dynamodb.model.CreateTableRequest; -import software.amazon.awssdk.services.dynamodb.model.CreateTableResponse; -import software.amazon.awssdk.services.dynamodb.model.DeleteRequest; -import software.amazon.awssdk.services.dynamodb.model.DeleteTableRequest; -import software.amazon.awssdk.services.dynamodb.model.DeleteTableResponse; -import software.amazon.awssdk.services.dynamodb.model.DescribeTableRequest; -import software.amazon.awssdk.services.dynamodb.model.DescribeTableResponse; -import software.amazon.awssdk.services.dynamodb.model.KeySchemaElement; -import software.amazon.awssdk.services.dynamodb.model.KeyType; -import software.amazon.awssdk.services.dynamodb.model.ListTablesRequest; -import software.amazon.awssdk.services.dynamodb.model.ListTablesResponse; -import software.amazon.awssdk.services.dynamodb.model.ProvisionedThroughput; -import software.amazon.awssdk.services.dynamodb.model.ProvisionedThroughputDescription; -import software.amazon.awssdk.services.dynamodb.model.ProvisionedThroughputExceededException; -import software.amazon.awssdk.services.dynamodb.model.PutRequest; -import software.amazon.awssdk.services.dynamodb.model.QueryRequest; -import software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType; -import software.amazon.awssdk.services.dynamodb.model.ScanRequest; -import software.amazon.awssdk.services.dynamodb.model.ScanResponse; -import software.amazon.awssdk.services.dynamodb.model.TableDescription; -import software.amazon.awssdk.services.dynamodb.model.TableStatus; -import software.amazon.awssdk.services.dynamodb.model.UpdateTableRequest; -import software.amazon.awssdk.services.dynamodb.model.WriteRequest; - -public class AmazonDynamoDatabaseDocApi implements IDatabase { - - private static final int MAX_NUMBER_OF_RETRIES = 5; - private final TankConfig config = new TankConfig(); - private DynamoDbClient dynamoDbClient; - - private static final ThreadPoolExecutor EXECUTOR = new ThreadPoolExecutor(10, 50, 60, TimeUnit.SECONDS, - new ArrayBlockingQueue(50), Executors.defaultThreadFactory(), - new ThreadPoolExecutor.DiscardOldestPolicy()); - - protected static final int BATCH_SIZE = 25; - private static final long MAX_WRITE_UNITS = 1500L; - - private static Logger LOG = LogManager.getLogger(AmazonDynamoDatabaseDocApi.class); - - /** - * - */ - public AmazonDynamoDatabaseDocApi() { - CloudCredentials creds = new TankConfig().getVmManagerConfig().getCloudCredentials(CloudProvider.amazon); - if (creds != null && StringUtils.isNotBlank(creds.getKey()) && StringUtils.isNotBlank(creds.getKeyId())) { - AwsCredentials credentials = AwsBasicCredentials.create(creds.getKeyId(), creds.getKey()); - this.dynamoDbClient = DynamoDbClient.builder().credentialsProvider(StaticCredentialsProvider.create(credentials)).build(); - } else { - this.dynamoDbClient = DynamoDbClient.builder().build(); - } - } - - /** - * - * @param dynamoDbClient - */ - public AmazonDynamoDatabaseDocApi(DynamoDbClient dynamoDbClient) { - this.dynamoDbClient = dynamoDbClient; - } - - /** - * - * {@inheritDoc} - */ - @Override - public void initNamespace(String tableName) { - try { - if (!hasTable(tableName)) { - LOG.info("Creating table: " + tableName); - HierarchicalConfiguration resultsProviderConfig = config.getVmManagerConfig() - .getResultsProviderConfig(); - long readCapacity = getCapacity(resultsProviderConfig, "read-capacity", 10L); - long writeCapacity = getCapacity(resultsProviderConfig, "write-capacity", 50L); - ArrayList attributeDefinitions = new ArrayList(); - attributeDefinitions.add(AttributeDefinition.builder().attributeName( - DatabaseKeys.JOB_ID_KEY.getShortKey()).attributeType(ScalarAttributeType.S).build()); - attributeDefinitions.add(AttributeDefinition.builder().attributeName( - DatabaseKeys.REQUEST_NAME_KEY.getShortKey()).attributeType(ScalarAttributeType.S).build()); - ProvisionedThroughput provisionedThroughput = ProvisionedThroughput.builder().readCapacityUnits( - readCapacity).writeCapacityUnits(writeCapacity).build(); - KeySchemaElement hashKeyElement = KeySchemaElement.builder().attributeName( - DatabaseKeys.JOB_ID_KEY.getShortKey()).keyType(KeyType.HASH).build(); - KeySchemaElement rangeKeyElement = KeySchemaElement.builder().attributeName( - DatabaseKeys.REQUEST_NAME_KEY.getShortKey()).keyType(KeyType.RANGE).build(); - CreateTableRequest request = CreateTableRequest.builder() - .tableName(tableName) - .keySchema(hashKeyElement, rangeKeyElement) - .attributeDefinitions(attributeDefinitions) - .provisionedThroughput(provisionedThroughput) - .build(); - - CreateTableResponse response = dynamoDbClient.createTable(request); - waitForStatus(tableName, TableStatus.ACTIVE); - LOG.info("Created table: " + response.tableDescription().tableName()); - } - } catch (Exception t) { - LOG.error(t, t); - throw new RuntimeException(t); - } - } - - private long getCapacity(HierarchicalConfiguration resultsProviderConfig, String key, long defaultValue) { - if (resultsProviderConfig != null) { - try { - String string = resultsProviderConfig.getString(key); - if (NumberUtils.isDigits(string)) { - return Long.parseLong(string); - } - } catch (Exception e) { - LOG.error(e.toString()); - } - } - return defaultValue; - } - - /** - * - * {@inheritDoc} - */ - @Override - public void removeNamespace(String tableName) { - try { - if (hasTable(tableName)) { - LOG.info("Deleting table: " + tableName); - DeleteTableRequest deleteTableRequest = DeleteTableRequest.builder().tableName(tableName).build(); - DeleteTableResponse response = dynamoDbClient.deleteTable(deleteTableRequest); - LOG.info("Deleted table: " + response.tableDescription().tableName()); - waitForDelete(tableName); - } - } catch (Exception t) { - LOG.error(t, t); - throw new RuntimeException(t); - } - } - - /** - * - * {@inheritDoc} - */ - @Override - public boolean hasTable(String tableName) { - String nextTableName = null; - do { - ListTablesResponse listTables = - dynamoDbClient.listTables(ListTablesRequest.builder().exclusiveStartTableName(nextTableName).build()); - for (String name : listTables.tableNames()) { - if (tableName.equalsIgnoreCase(name)) { - return true; - } - } - nextTableName = listTables.lastEvaluatedTableName(); - } while (nextTableName != null); - return false; - } - - /** - * - * {@inheritDoc} - */ - @Override - public void addTimingResults(final @Nonnull String tableName, final @Nonnull List results, - boolean async) { - if (!results.isEmpty()) { - Runnable task = new Runnable() { - public void run() { - MethodTimer mt = new MethodTimer(LOG, this.getClass(), "addTimingResults (" + results + ")"); - List requests; - try { - requests = results.stream() - .map(result -> getTimingAttributes(result)) - .map(item -> PutRequest.builder().item(item).build()) - .map(putRequest -> WriteRequest.builder().putRequest(putRequest).build()) - .collect(Collectors.toList()); - sendBatch(tableName, requests); - } catch (Exception t) { - LOG.error("Error adding results: " + t.getMessage(), t); - throw new RuntimeException(t); - } - mt.endAndLog(); - } - }; - if (async) { - EXECUTOR.execute(task); - } else { - task.run(); - } - } - } - - /** - * - * {@inheritDoc} - */ - @Override - public Set getTables(String regex) { - Set result = new HashSet(); - String nextTableName = null; - do { - ListTablesResponse listTables = dynamoDbClient.listTables(ListTablesRequest.builder() - .exclusiveStartTableName(nextTableName).build()); - for (String s : listTables.tableNames()) { - if (s.matches(regex)) { - result.add(s); - } - } - nextTableName = listTables.lastEvaluatedTableName(); - } while (nextTableName != null); - - return result; - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - @Override - public PagedDatabaseResult getPagedItems(String tableName, Object nextToken, String minRange, - String maxRange, String instanceId, String jobId) { - Map lastKeyEvaluated = (Map) nextToken; - ScanRequest.Builder scanRequest = ScanRequest.builder().tableName(tableName); - Map conditions = new HashMap(); - if (jobId != null) { - Condition jobIdCondition = Condition.builder().comparisonOperator(ComparisonOperator.EQ) - .attributeValueList(AttributeValue.builder().s(jobId).build()).build(); - conditions.put(DatabaseKeys.JOB_ID_KEY.getShortKey(), jobIdCondition); - } - if (StringUtils.isNotBlank(instanceId)) { - // add a filter - Condition filter = Condition.builder() - .comparisonOperator(ComparisonOperator.EQ) - .attributeValueList(AttributeValue.builder().s(instanceId).build()) - .build(); - Map map = new HashMap<>(); - map.put(DatabaseKeys.INSTANCE_ID_KEY.getShortKey(), filter); - scanRequest.scanFilter(map); - } - Condition.Builder rangeKeyCondition = Condition.builder(); - if (minRange != null && maxRange != null) { - rangeKeyCondition.comparisonOperator(ComparisonOperator.BETWEEN.toString()) - .attributeValueList(AttributeValue.builder().s(minRange).build()) - .attributeValueList(AttributeValue.builder().s(maxRange).build()); - } else if (minRange != null) { - rangeKeyCondition.comparisonOperator(ComparisonOperator.GE.toString()) - .attributeValueList(AttributeValue.builder().s(minRange).build()); - } else if (maxRange != null) { - rangeKeyCondition.comparisonOperator(ComparisonOperator.LT.toString()) - .attributeValueList(AttributeValue.builder().s(maxRange).build()); - } else { - rangeKeyCondition = null; - } - if (rangeKeyCondition != null) { - conditions.put(DatabaseKeys.REQUEST_NAME_KEY.getShortKey(), rangeKeyCondition.build()); - } - scanRequest.scanFilter(conditions); - scanRequest.exclusiveStartKey(lastKeyEvaluated); - - ScanResponse response = dynamoDbClient.scan(scanRequest.build()); - return new PagedDatabaseResult( - response.items().stream().map(this::getItemFromResult).collect(Collectors.toList()), - response.lastEvaluatedKey()); - } - - /** - * - * {@inheritDoc} - */ - @Nonnull - @Override - public List getItems(String tableName, String minRange, String maxRange, String instanceId, - String... jobIds) { - List ret = new ArrayList(); - for (String jobId : jobIds) { - Object lastKeyEvaluated = null; - do { - PagedDatabaseResult pagedItems = getPagedItems(tableName, lastKeyEvaluated, minRange, maxRange, - instanceId, jobId); - ret.addAll(pagedItems.getItems()); - lastKeyEvaluated = pagedItems.getNextToken(); - } while (lastKeyEvaluated != null); - } - return ret; - } - - /** - * {@inheritDoc} - */ - @Override - public void addItems(final String tableName, List itemList, final boolean asynch) { - if (!itemList.isEmpty()) { - final List items = new ArrayList(itemList); - Runnable task = new Runnable() { - public void run() { - MethodTimer mt = new MethodTimer(LOG, this.getClass(), "addItems (" + items + ")"); - List requests; - try { - requests = items.stream() - .map(item -> itemToMap(item)) - .map(toInsert -> PutRequest.builder().item(toInsert).build()) - .map(putRequest -> WriteRequest.builder().putRequest(putRequest).build()) - .collect(Collectors.toList()); - sendBatch(tableName, requests); - } catch (Exception t) { - LOG.error("Error adding results: " + t.getMessage(), t); - throw new RuntimeException(t); - } - mt.endAndLog(); - } - }; - if (asynch) { - EXECUTOR.execute(task); - } else { - task.run(); - } - } - } - - /** - * {@inheritDoc} - */ - @Override - public void deleteForJob(final String tableName, final String jobId, final boolean asynch) { - Runnable task = new Runnable() { - public void run() { - MethodTimer mt = new MethodTimer(LOG, this.getClass(), "deleteForJob (" + jobId + ")"); - - List items = getItems(tableName, null, null, null, jobId); - if (!items.isEmpty()) { - List requests = new ArrayList(); - try { - for (Item item : items) { - String id = item.getAttributes().stream().filter(attr -> DatabaseKeys.REQUEST_NAME_KEY.getShortKey().equals(attr.getName())).findFirst().map(Attribute::getValue).orElse(null); - if (id != null) { - Map keyMap = new HashMap(); - keyMap.put(DatabaseKeys.REQUEST_NAME_KEY.getShortKey(), AttributeValue.builder().s(id).build()); - keyMap.put(DatabaseKeys.JOB_ID_KEY.getShortKey(), AttributeValue.builder().s(jobId).build()); - DeleteRequest deleteRequest = DeleteRequest.builder().key(keyMap).build(); - WriteRequest writeRequest = WriteRequest.builder().deleteRequest(deleteRequest).build(); - requests.add(writeRequest); - } - } - sendBatch(tableName, requests); - } catch (Exception t) { - LOG.error("Error adding results: " + t.getMessage(), t); - throw new RuntimeException(t); - } - } - mt.endAndLog(); - } - }; - if (asynch) { - EXECUTOR.execute(task); - } else { - task.run(); - } - - } - - @Override - public String getDatabaseName(TankDatabaseType type, String jobId) { - return type.name() + "_" + new TankConfig().getInstanceName(); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean hasJobData(String tableName, String jobId) { - if (hasTable(tableName)) { - Map keyConditions = new HashMap(); - Condition jobIdCondition = Condition.builder().comparisonOperator(ComparisonOperator.EQ) - .attributeValueList(AttributeValue.builder().s(jobId).build()).build(); - keyConditions.put(DatabaseKeys.JOB_ID_KEY.getShortKey(), jobIdCondition); - QueryRequest queryRequest = QueryRequest.builder().tableName(tableName).keyConditions(keyConditions) - .limit(1).build(); - - return dynamoDbClient.query(queryRequest).count() > 0; - } - return false; - } - - /** - * @param attributeMap - * @return - */ - private Item getItemFromResult(Map attributeMap) { - List attrs = new ArrayList(); - Item ret = new Item(null, attrs); - for (Map.Entry item : attributeMap.entrySet()) { - Attribute a = new Attribute(item.getKey(), item.getValue().s()); - attrs.add(a); - if (a.getName().equalsIgnoreCase(DatabaseKeys.LOGGING_KEY_KEY.getShortKey())) { - ret.setName(a.getValue()); - } - } - return ret; - } - - private Map getTimingAttributes(TankResult result) { - Map attributes = new HashMap(); - String timestamp = ReportUtil.getTimestamp(result.getTimeStamp()); - addAttribute(attributes, DatabaseKeys.TIMESTAMP_KEY.getShortKey(), timestamp); - addAttribute(attributes, DatabaseKeys.REQUEST_NAME_KEY.getShortKey(), timestamp + "-" - + UUID.randomUUID().toString()); - addAttribute(attributes, DatabaseKeys.JOB_ID_KEY.getShortKey(), result.getJobId()); - addAttribute(attributes, DatabaseKeys.LOGGING_KEY_KEY.getShortKey(), result.getRequestName()); - addAttribute(attributes, DatabaseKeys.STATUS_CODE_KEY.getShortKey(), String.valueOf(result.getStatusCode())); - addAttribute(attributes, DatabaseKeys.RESPONSE_TIME_KEY.getShortKey(), - String.valueOf(result.getResponseTime())); - addAttribute(attributes, DatabaseKeys.RESPONSE_SIZE_KEY.getShortKey(), String.valueOf(result.getResponseSize())); - addAttribute(attributes, DatabaseKeys.INSTANCE_ID_KEY.getShortKey(), String.valueOf(result.getInstanceId())); - addAttribute(attributes, DatabaseKeys.IS_ERROR_KEY.getShortKey(), String.valueOf(result.isError())); - return attributes; - } - - private void addAttribute(Map attributes, String key, String value) { - if (value == null) { - value = ""; - } - attributes.put(key, AttributeValue.builder().s(value).build()); - } - - private void addItemsToTable(String tableName, final BatchWriteItemRequest request) { - - boolean shouldRetry; - int retries = 0; - - do { - shouldRetry = false; - try { - BatchWriteItemResponse response = dynamoDbClient.batchWriteItem(request); - if (response != null) { - try { - List consumedCapacity = response.consumedCapacity(); - for (ConsumedCapacity cap : consumedCapacity) { - LOG.info(cap.capacityUnits()); - } - } catch (Exception e) { - // ignore this - } - } - } catch (AwsServiceException e) { - if (e instanceof ProvisionedThroughputExceededException) { - try { - DescribeTableResponse response = - dynamoDbClient.describeTable(DescribeTableRequest.builder().tableName(tableName).build()); - ProvisionedThroughputDescription oldThroughput = response.table().provisionedThroughput(); - LOG.info("ProvisionedThroughputExceeded throughput = " + oldThroughput); - ProvisionedThroughput newThroughput = ProvisionedThroughput.builder() - .readCapacityUnits(response.table().provisionedThroughput().readCapacityUnits()) - .writeCapacityUnits(getIncreasedThroughput(response.table().provisionedThroughput() - .readCapacityUnits())).build(); - - if (!oldThroughput.equals(newThroughput)) { - LOG.info("Updating throughput to " + newThroughput); - dynamoDbClient.updateTable(UpdateTableRequest.builder().provisionedThroughput(newThroughput).build()); - } - } catch (Exception e1) { - LOG.error("Error increasing capacity: " + e, e); - } - } - int status = e.statusCode(); - if (status == HttpStatus.SC_INTERNAL_SERVER_ERROR - || status == HttpStatus.SC_SERVICE_UNAVAILABLE) { - shouldRetry = true; - long delay = (long) (Math.random() * (Math.pow(4, retries++) * 100L)); - try { - Thread.sleep(delay); - } catch (InterruptedException iex) { - LOG.error("Caught InterruptedException exception", iex); - } - } else { - LOG.error("Error writing to DB: " + e.getMessage()); - throw new RuntimeException(e); - } - } - } while (shouldRetry && retries < MAX_NUMBER_OF_RETRIES); - - } - - private Long getIncreasedThroughput(Long readCapacityUnits) { - long ret = readCapacityUnits * 2; - if (ret > MAX_WRITE_UNITS) { - ret = MAX_WRITE_UNITS; - } - return ret; - } - - private void waitForStatus(String tableName, TableStatus status) { - LOG.info("Waiting for " + tableName + " to become " + status.toString() + "..."); - - long startTime = System.currentTimeMillis(); - long endTime = startTime + (10 * 60 * 1000); - while (System.currentTimeMillis() < endTime) { - try { - Thread.sleep(1000 * 2); - } catch (Exception e) { - } - try { - DescribeTableRequest request = DescribeTableRequest.builder().tableName(tableName).build(); - TableDescription tableDescription = dynamoDbClient.describeTable(request).table(); - String tableStatus = tableDescription.tableStatusAsString(); - LOG.debug(" - current state: " + tableStatus); - if (tableStatus.equals(status.toString())) - return; - } catch (AwsServiceException ase) { - if (!ase.awsErrorDetails().errorCode().equalsIgnoreCase("ResourceNotFoundException")) - throw ase; - } - } - - throw new RuntimeException("Table " + tableName + " never went " + status.toString()); - } - - private void waitForDelete(String tableName) { - LOG.info("Waiting for " + tableName + " to become deleted..."); - - long startTime = System.currentTimeMillis(); - long endTime = startTime + (10 * 60 * 1000); - while (System.currentTimeMillis() < endTime) { - try { - Thread.sleep(1000 * 2); - } catch (Exception e) { - } - try { - if (!hasTable(tableName)) { - return; - } - } catch (AwsServiceException ase) { - if (!ase.awsErrorDetails().errorCode().equalsIgnoreCase("ResourceNotFoundException")) - throw ase; - } - } - - throw new RuntimeException("Table " + tableName + " never deleted"); - } - - /** - * @param item - * @return - */ - private Map itemToMap(Item item) { - Map attributes = new HashMap(); - for (Attribute attr : item.getAttributes()) { - addAttribute(attributes, attr.getName(), attr.getValue()); - } - if (!attributes.containsKey(DatabaseKeys.JOB_ID_KEY.getShortKey())) { - throw new RuntimeException("Item does not contain a job ID"); - } else if (!attributes.containsKey(DatabaseKeys.REQUEST_NAME_KEY.getShortKey())) { - AttributeValue attVal = attributes.get(DatabaseKeys.TIMESTAMP_KEY.getShortKey()); - String timestamp = attVal != null ? attVal.s() : ReportUtil.getTimestamp(new Date()); - if (attVal == null) { - addAttribute(attributes, DatabaseKeys.TIMESTAMP_KEY.getShortKey(), timestamp); - } - addAttribute(attributes, DatabaseKeys.REQUEST_NAME_KEY.getShortKey(), timestamp + "-" - + UUID.randomUUID().toString()); - } - - return attributes; - } - - /** - * @param tableName - * @param requests - */ - private void sendBatch(final String tableName, List requests) { - int numBatches = (int) Math.ceil(requests.size() / (BATCH_SIZE * 1D)); - for (int i = 0; i < numBatches; i++) { - Map> requestItems = new HashMap>(); - List batch = requests.subList(i * BATCH_SIZE, - Math.min(i * BATCH_SIZE + BATCH_SIZE, requests.size())); - requestItems.put(tableName, batch); - addItemsToTable(tableName, BatchWriteItemRequest.builder().requestItems(requestItems).build()); - } - } -} diff --git a/reporting/db/src/main/java/com/intuit/tank/persistence/databases/BucketDataItem.java b/reporting/db/src/main/java/com/intuit/tank/persistence/databases/BucketDataItem.java deleted file mode 100644 index b3a29b464..000000000 --- a/reporting/db/src/main/java/com/intuit/tank/persistence/databases/BucketDataItem.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Copyright 2011 Intuit Inc. All Rights Reserved - */ -package com.intuit.tank.persistence.databases; - -/* - * #%L - * Reporting database support - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -import java.io.Serializable; -import java.util.Date; - -import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; - -/** - * BucketDataItem - * - * @author dangleton - * - */ -public class BucketDataItem implements Serializable { - - private static final long serialVersionUID = 1L; - private int period = 15; - private Date startTime; - private DescriptiveStatistics stats; - - /** - * @param period - * @param startTime - * @param stats - */ - public BucketDataItem(int period, Date startTime, DescriptiveStatistics stats) { - super(); - this.period = period; - this.startTime = startTime; - this.stats = stats; - } - - /** - * @return the period - */ - public int getPeriod() { - return period; - } - - /** - * @return the startTime - */ - public Date getStartTime() { - return startTime; - } - - /** - * @return the stats - */ - public DescriptiveStatistics getStats() { - return stats; - } - -} diff --git a/reporting/db/src/main/java/com/intuit/tank/persistence/databases/CloudWatchDataSource.java b/reporting/db/src/main/java/com/intuit/tank/persistence/databases/CloudWatchDataSource.java deleted file mode 100644 index f40228c67..000000000 --- a/reporting/db/src/main/java/com/intuit/tank/persistence/databases/CloudWatchDataSource.java +++ /dev/null @@ -1,175 +0,0 @@ -package com.intuit.tank.persistence.databases; - -import com.intuit.tank.reporting.databases.IDatabase; -import com.intuit.tank.reporting.databases.Item; -import com.intuit.tank.reporting.databases.PagedDatabaseResult; -import com.intuit.tank.reporting.databases.TankDatabaseType; -import com.intuit.tank.results.TankResult; -import com.intuit.tank.vm.settings.CloudCredentials; -import com.intuit.tank.vm.settings.CloudProvider; -import com.intuit.tank.vm.settings.TankConfig; -import org.apache.commons.lang3.StringUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; -import software.amazon.awssdk.auth.credentials.AwsCredentials; -import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; -import software.amazon.awssdk.services.cloudwatch.CloudWatchAsyncClient; -import software.amazon.awssdk.services.cloudwatch.model.Dimension; -import software.amazon.awssdk.services.cloudwatch.model.MetricDatum; -import software.amazon.awssdk.services.cloudwatch.model.PutMetricDataRequest; -import software.amazon.awssdk.services.cloudwatch.model.StandardUnit; -import software.amazon.awssdk.services.cloudwatch.model.StatisticSet; - -import jakarta.annotation.Nonnull; -import java.time.Instant; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.function.Supplier; -import java.util.stream.Collectors; -import java.util.stream.DoubleStream; - -import static java.util.stream.Collectors.groupingBy; -import static java.util.stream.Collectors.toList; - -/** - * CloudWatchDataSource - * - * @author Kevin McGoldrick - * - */ -public class CloudWatchDataSource implements IDatabase { - private static final Logger LOG = LogManager.getLogger(CloudWatchDataSource.class); - - private CloudWatchAsyncClient cloudWatchClient; - private static final int MAX_CLOUDWATCH_METRICS_SUPPORTED = 150; - private static final String namespace = "Intuit/Tank"; - - public CloudWatchDataSource() { - CloudCredentials creds = new TankConfig().getVmManagerConfig().getCloudCredentials(CloudProvider.amazon); - if (creds != null && StringUtils.isNotBlank(creds.getKey()) && StringUtils.isNotBlank(creds.getKeyId())) { - AwsCredentials credentials = AwsBasicCredentials.create(creds.getKeyId(), creds.getKey()); - this.cloudWatchClient = CloudWatchAsyncClient.builder().credentialsProvider(StaticCredentialsProvider.create(credentials)).build(); - } else { - this.cloudWatchClient = CloudWatchAsyncClient.builder().build(); - } - } - - @Override - public void initNamespace(@Nonnull String tableName) {} - - @Override - public void removeNamespace(@Nonnull String tableName) {} - - @Override - public void deleteForJob(@Nonnull String tableName, @Nonnull String jobId, boolean asynch) {} - - @Override - public boolean hasTable(@Nonnull String tableName) { - return true; - } - - @Override - public boolean hasJobData(@Nonnull String tableName, String jobId) { - return true; - } - - @Override - public void addTimingResults(@Nonnull String tableName, @Nonnull List results, boolean asynch) { - LOG.trace("Starting addTimingResults with " + results.size() + " items"); - Instant timestamp = results.get(results.size()-1).getTimeStamp().toInstant(); - List datumList = new ArrayList<>(); - - Dimension instanceId = Dimension.builder() - .name("InstanceId") - .value(results.get(0).getInstanceId()) - .build(); - - Dimension jobId = Dimension.builder() - .name("JobId") - .value(results.get(0).getJobId()) - .build(); - try { - Map> grouped = results.stream() - .collect(groupingBy(TankResult::getRequestName, - Collectors.mapping(TankResult::getResponseTime, toList()))); - LOG.trace("Sorted into " + grouped.size() + " request name groups"); - - for (Map.Entry> entry : grouped.entrySet()) { - List groupResults = entry.getValue(); - int size = groupResults.size(); - Supplier doubleStream = - () -> groupResults.stream() - .sorted() - .mapToDouble(Double::valueOf); - Collection sortedList = doubleStream.get() - .boxed().limit(MAX_CLOUDWATCH_METRICS_SUPPORTED).collect(Collectors.toList()); - double[] sortedArray = doubleStream.get().toArray(); - double sum = doubleStream.get().sum(); - - Dimension request = Dimension.builder() - .name("RequestName") - .value(entry.getKey()) - .build(); - - datumList.add(MetricDatum.builder() - .metricName("ResponseTime") - .unit(StandardUnit.MILLISECONDS) - .statisticValues(StatisticSet.builder() - .maximum(sortedArray[size - 1]) - .minimum(sortedArray[0]) - .sampleCount((double) size) - .sum(sum) - .build()) - .values(sortedList) - .timestamp(timestamp) - .dimensions(request, instanceId, jobId) - .build()); - - datumList.add(MetricDatum.builder() - .metricName("RequestCount") - .unit(StandardUnit.COUNT) - .value((double) size) - .timestamp(timestamp) - .dimensions(request, instanceId, jobId) - .build()); - } - LOG.trace("Sending to CloudWatchMetrics: " + datumList.size() + " to " + namespace); - PutMetricDataRequest request = PutMetricDataRequest.builder() - .namespace(namespace) - .metricData(datumList) - .build(); - - cloudWatchClient.putMetricData(request); - } catch (Exception e) { - LOG.error("Failed to push metric data to cloudwatch: " + e.getMessage(), e); - } - } - - @Override - public Set getTables(String regex) { - return null; - } - - @Override - public void addItems(String tableName, List items, boolean asynch) {} - - @Nonnull - @Override - public List getItems(String tableName, String minRange, String maxRange, String instanceId, String... jobId) { - return new ArrayList<>(); - } - - @Override - public PagedDatabaseResult getPagedItems(String tableName, Object nextToken, String minRange, String maxRange, String instanceId, String jobId) { - return null; - } - - @Override - public String getDatabaseName(TankDatabaseType type, String jobId) { - return namespace; - } -} diff --git a/reporting/db/src/main/java/com/intuit/tank/persistence/databases/DataBaseFactory.java b/reporting/db/src/main/java/com/intuit/tank/persistence/databases/DataBaseFactory.java deleted file mode 100644 index f510a957e..000000000 --- a/reporting/db/src/main/java/com/intuit/tank/persistence/databases/DataBaseFactory.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright 2011 Intuit Inc. All Rights Reserved - */ -package com.intuit.tank.persistence.databases; - -/* - * #%L - * Reporting database support - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -import com.intuit.tank.reporting.databases.IDatabase; -import com.intuit.tank.vm.settings.TankConfig; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -/** - * DataBaseFactory - * - * @author dangleton - * - */ -public class DataBaseFactory { - private static final Logger LOG = LogManager.getLogger(DataBaseFactory.class); - private static final String resultsProvider = new TankConfig().getVmManagerConfig().getResultsProvider(); - - public static IDatabase getDatabase() { - return initProvider(); - } - - private static IDatabase initProvider() { - try { - return (IDatabase) Class.forName(resultsProvider).newInstance(); - } catch (Exception e) { - LOG.error("Unable to create DataSource Provider : " + resultsProvider + ", update settings.xml", e); - } - return new CloudWatchDataSource(); - } -} diff --git a/reporting/db/src/main/java/com/intuit/tank/persistence/databases/DatabaseKeys.java b/reporting/db/src/main/java/com/intuit/tank/persistence/databases/DatabaseKeys.java deleted file mode 100644 index 55f038c50..000000000 --- a/reporting/db/src/main/java/com/intuit/tank/persistence/databases/DatabaseKeys.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.intuit.tank.persistence.databases; - -/* - * #%L - * Reporting database support - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -public enum DatabaseKeys { - - // these have to be unique - REQUEST_NAME_KEY("RN"), - JOB_ID_KEY("ID"), - STATUS_CODE_KEY("SC"), - CONNECTION_TIME_KEY("CT"), - REQUEST_SIZE_KEY("RS"), - RESPONSE_TIME_KEY("RT"), - RESPONSE_SIZE_KEY("RE"), - IS_ERROR_KEY("IE"), - TIMESTAMP_KEY("TS"), - LOGGING_KEY_KEY("LK"), - PERIOD_KEY("RP"), - TRANSACTIONS_KEY("TX"), - INSTANCE_ID_KEY("II"); - - private String shortKey; - - DatabaseKeys(String shortKey) { - this.shortKey = shortKey; - } - - public String getShortKey() { - return this.shortKey; - } - -} diff --git a/reporting/db/src/main/java/com/intuit/tank/persistence/databases/DatabaseQueue.java b/reporting/db/src/main/java/com/intuit/tank/persistence/databases/DatabaseQueue.java deleted file mode 100644 index f59d98e77..000000000 --- a/reporting/db/src/main/java/com/intuit/tank/persistence/databases/DatabaseQueue.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.intuit.tank.persistence.databases; - -/* - * #%L - * Reporting database support - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -public class DatabaseQueue { - - private static DatabaseQueue instance = new DatabaseQueue(); - private ExecutorService executor; - - private DatabaseQueue() { - executor = Executors.newFixedThreadPool(1000); - } - - public static DatabaseQueue getInstance() { - return instance; - } - - public DatabaseQueue clone() throws CloneNotSupportedException { - throw new CloneNotSupportedException(); - } - - public void execute(Runnable runnable) { - executor.execute(runnable); - } -} diff --git a/reporting/db/src/main/java/com/intuit/tank/persistence/databases/GraphiteDatasource.java b/reporting/db/src/main/java/com/intuit/tank/persistence/databases/GraphiteDatasource.java deleted file mode 100644 index 676edd003..000000000 --- a/reporting/db/src/main/java/com/intuit/tank/persistence/databases/GraphiteDatasource.java +++ /dev/null @@ -1,200 +0,0 @@ -package com.intuit.tank.persistence.databases; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintWriter; -import java.net.Socket; -import java.net.UnknownHostException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Set; - -import org.apache.commons.configuration.HierarchicalConfiguration; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.math.NumberUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import com.intuit.tank.reporting.databases.IDatabase; -import com.intuit.tank.reporting.databases.Item; -import com.intuit.tank.reporting.databases.PagedDatabaseResult; -import com.intuit.tank.reporting.databases.TankDatabaseType; -import com.intuit.tank.results.TankResult; -import com.intuit.tank.vm.settings.TankConfig; - -import jakarta.annotation.Nonnull; - -/** - * GraphiteDatasource - * - * @author Kevin McGoldrick - * - */ -public class GraphiteDatasource implements IDatabase { - private static final Logger LOG = LogManager.getLogger(GraphiteDatasource.class); - - private String enviornemnt = "qa"; - private String host = "doubleshot.perf.a.intuit.com"; - private int port = 2003; - private int interval = 15; // SECONDS - - private TankConfig config = new TankConfig(); - private HierarchicalConfiguration resultsProviderConfig = config.getVmManagerConfig().getResultsProviderConfig(); - - @Override - public void initNamespace(String tableName) { - // TODO Auto-generated method stub - } - - @Override - public void removeNamespace(String tableName) { - // TODO Auto-generated method stub - - } - - @Override - public void deleteForJob(String tableName, String jobId, boolean asynch) { - // TODO Auto-generated method stub - - } - - @Override - public boolean hasTable(String tableName) { - // TODO Auto-generated method stub - return true; - } - - @Override - public boolean hasJobData(String tableName, String jobId) { - // TODO Auto-generated method stub - return true; - } - - @SuppressWarnings("unchecked") - @Override - public void addTimingResults(String tableName, List results, boolean asynch) { - if (resultsProviderConfig != null) { - try { - enviornemnt = config.getInstanceName(); - host = resultsProviderConfig.getString("graphiteHost"); - String s = resultsProviderConfig.getString("graphitePort"); - if (NumberUtils.isDigits(s)) { - port = Integer.parseInt(s); - } - } catch (Exception e) { - LOG.error("Failed to get Graphite parameters " + e.toString()); - } - } - String jobId = results.get(0).getJobId(); - long l = results.get(results.size()-1).getTimeStamp().getTime() / 1000; - Collections.sort(results); - try { - Socket socket = new Socket(host, port); - OutputStream s = socket.getOutputStream(); - PrintWriter out = new PrintWriter(s, true); - List groupResults = new ArrayList(); - String requestName = ""; - long sum = 0; - //int count = 0; - for (TankResult metric: results) { - if (StringUtils.equalsIgnoreCase(metric.getRequestName(), requestName)) { //Middle of the Group - groupResults.add(Long.valueOf(metric.getResponseTime())); - sum += metric.getResponseTime(); - } else if (StringUtils.isEmpty(requestName)) { // Handles the first time through // - requestName = metric.getRequestName(); - sum = metric.getResponseTime(); - groupResults.add(Long.valueOf(sum)); - } else { // Handles the last time through of the group// - int size = groupResults.size(); - Collections.sort(groupResults); - Long[] sortedList = groupResults.toArray(new Long[size]); - long average = sum / size; - long tps = size / interval; - int fiftieth = (size/2); - if (fiftieth >= 1) fiftieth--; - float ninety = 0.9f; - int ninetieth = Math.round(size * ninety); - if (ninetieth >= 1) ninetieth--; - float ninetynine = 0.99f; - int ninetynineth = Math.round(size * ninetynine); - if (ninetynineth >= 1) ninetynineth--; - out.printf("tank.%s.%s.%s.ResponseTime.MIN %d %d%n", enviornemnt, jobId, requestName, sortedList[0], l ); - out.printf("tank.%s.%s.%s.ResponseTime.AVG %d %d%n", enviornemnt, jobId, requestName, average, l ); - out.printf("tank.%s.%s.%s.ResponseTime.MAX %d %d%n", enviornemnt, jobId, requestName, sortedList[size - 1], l ); - out.printf("tank.%s.%s.%s.ResponseTime.50th %d %d%n", enviornemnt, jobId, requestName, sortedList[fiftieth], l ); - out.printf("tank.%s.%s.%s.ResponseTime.90th %d %d%n", enviornemnt, jobId, requestName, sortedList[ninetieth], l ); - out.printf("tank.%s.%s.%s.ResponseTime.99th %d %d%n", enviornemnt, jobId, requestName, sortedList[ninetynineth], l ); - out.printf("tank.%s.%s.%s.TPS %d %d%n", enviornemnt, jobId, requestName, tps, l ); - out.printf("tank.%s.%s.%s.count %d %d%n", enviornemnt, jobId, requestName, size, l ); - requestName = metric.getRequestName(); - groupResults.clear(); - groupResults.add(Long.valueOf(metric.getResponseTime())); - sum = 0; - } - } // Get that last one // - int size = groupResults.size(); - Collections.sort(groupResults); - Long[] sortedList = groupResults.toArray(new Long[size]); - long average = sum / size; - long tps = size / interval; - int fiftieth = (size/2); - if (fiftieth >= 1) fiftieth--; - float ninety = 0.9f; - int ninetieth = Math.round(size * ninety); - if (ninetieth >= 1) ninetieth--; - float ninetynine = 0.99f; - int ninetynineth = Math.round(size * ninetynine); - if (ninetynineth >= 1) ninetynineth--; - out.printf("tank.%s.%s.%s.ResponseTime.MIN %d %d%n", enviornemnt, jobId, requestName, sortedList[0], l ); - out.printf("tank.%s.%s.%s.ResponseTime.AVG %d %d%n", enviornemnt, jobId, requestName, average, l ); - out.printf("tank.%s.%s.%s.ResponseTime.MAX %d %d%n", enviornemnt, jobId, requestName, sortedList[size - 1], l ); - out.printf("tank.%s.%s.%s.ResponseTime.50th %d %d%n", enviornemnt, jobId, requestName, sortedList[fiftieth], l ); - out.printf("tank.%s.%s.%s.ResponseTime.90th %d %d%n", enviornemnt, jobId, requestName, sortedList[ninetieth], l ); - out.printf("tank.%s.%s.%s.ResponseTime.99th %d %d%n", enviornemnt, jobId, requestName, sortedList[ninetynineth], l ); - out.printf("tank.%s.%s.%s.TPS %d %d%n", enviornemnt, jobId, requestName, tps, l ); - out.printf("tank.%s.%s.%s.count %d %d%n", enviornemnt, jobId, requestName, size, l ); - out.close(); - socket.close(); - } catch (UnknownHostException e) { - LOG.error("Unknown host: " + host); - } catch (IOException e) { - LOG.error("Error while writing data to graphite: " + e.getMessage(), e); - } catch (Exception e) { - LOG.error("Error: " + e.getMessage(), e); - } - } - - @Override - public Set getTables(String regex) { - // TODO Auto-generated method stub - return null; - } - - @Override - public void addItems(String tableName, List items, boolean asynch) { - // TODO Auto-generated method stub - - } - - @Nonnull - @Override - public List getItems(String tableName, String minRange, String maxRange, String instanceId, String... jobId) { - return new ArrayList<>(); - } - - @Override - public PagedDatabaseResult getPagedItems(String tableName, - Object nextToken, String minRange, String maxRange, - String instanceId, String jobId) { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getDatabaseName(TankDatabaseType type, String jobId) { - // TODO Auto-generated method stub - return host; - } - -} diff --git a/reporting/db/src/main/java/com/intuit/tank/persistence/databases/MetricsCalculator.java b/reporting/db/src/main/java/com/intuit/tank/persistence/databases/MetricsCalculator.java deleted file mode 100644 index a29de7a02..000000000 --- a/reporting/db/src/main/java/com/intuit/tank/persistence/databases/MetricsCalculator.java +++ /dev/null @@ -1,189 +0,0 @@ -/** - * Copyright 2011 Intuit Inc. All Rights Reserved - */ -package com.intuit.tank.persistence.databases; - -/* - * #%L - * Reporting database support - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; -import java.util.zip.GZIPOutputStream; - -import jakarta.annotation.Nonnull; - -import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import com.intuit.tank.reporting.api.PagedTimingResults; -import com.intuit.tank.reporting.api.ResultsReader; -import com.intuit.tank.reporting.factory.ReportingFactory; -import com.intuit.tank.results.TankResult; -import com.intuit.tank.storage.FileData; -import com.intuit.tank.storage.FileStorage; -import com.intuit.tank.storage.FileStorageFactory; -import com.intuit.tank.vm.common.util.MethodTimer; -import com.intuit.tank.vm.common.util.ReportUtil; -import com.intuit.tank.vm.settings.TankConfig; -import com.intuit.tank.vm.settings.TimeUtil; -import com.opencsv.CSVWriter; - -/** - * MetricsCalculator - * - * @author dangleton - * - */ -public class MetricsCalculator { - - private static final Logger LOG = LogManager.getLogger(MetricsCalculator.class); - - private Map summaryResults = new HashMap(); - private Map> bucketItems = new HashMap>(); - private static final String[] FIELDS = { - DatabaseKeys.TIMESTAMP_KEY.getShortKey(), - DatabaseKeys.JOB_ID_KEY.getShortKey(), - DatabaseKeys.INSTANCE_ID_KEY.getShortKey(), - DatabaseKeys.LOGGING_KEY_KEY.getShortKey(), - DatabaseKeys.STATUS_CODE_KEY.getShortKey(), - DatabaseKeys.RESPONSE_TIME_KEY.getShortKey(), - DatabaseKeys.RESPONSE_SIZE_KEY.getShortKey(), - DatabaseKeys.IS_ERROR_KEY.getShortKey() - }; - - /** - * @param jobId - * @param start - * @param end - * {@inheritDoc} - */ - public void retrieveAndCalculateTimingData(@Nonnull String jobId, Date start, Date end) { - MethodTimer mt = new MethodTimer(LOG, this.getClass(), "retrieveAndCalculateSummaryTimingCsv"); - int period = 15; - int count = 0; - try ( Writer csvFile = new OutputStreamWriter( - new GZIPOutputStream( - new FileOutputStream(File.createTempFile("timing", ".csv.gz")))); - CSVWriter csvWriter = new CSVWriter(csvFile) ){ - ResultsReader resultsReader = ReportingFactory.getResultsReader(); - Object nextToken = null; - csvWriter.writeNext(FIELDS); - do { - PagedTimingResults results = resultsReader.getPagedTimingResults(jobId, nextToken); - for (TankResult result : results.getResults()) { - count++; - String[] entryArray = getCsvArray(result); - csvWriter.writeNext(entryArray); - if (count % 1000 == 0) { - csvWriter.flush(); - } - - double d = result.getResponseTime(); - if (!skipDate(result.getTimeStamp(), start, end)) { - DescriptiveStatistics statistics = summaryResults.get(result.getRequestName()); - if (statistics == null) { - statistics = new DescriptiveStatistics(); - summaryResults.put(result.getRequestName(), statistics); - } - statistics.addValue(d); - } - if (result.getTimeStamp() != null) { - Date periodDate = TimeUtil.normalizeToPeriod(period, result.getTimeStamp()); - DescriptiveStatistics bucketStats = getBucketStats(result.getRequestName(), period, periodDate); - bucketStats.addValue(d); - } - } - nextToken = results.getNextToken(); - } while (nextToken != null); - } catch (IOException e) { - LOG.warn("Error closing csv file: " + e); - } - try ( InputStream is = new FileInputStream(File.createTempFile("timing", ".csv.gz")) ) { - String fileName = "timing_" + new TankConfig().getInstanceName() + "_" + jobId + ".csv.gz"; - FileStorage fileStorage = FileStorageFactory.getFileStorage(new TankConfig().getTimingDir(), false); - FileData fd = new FileData("",fileName); - fileStorage.storeFileData(fd, is); - mt.endAndLog(); - LOG.info("Processed " + count + " total items for job " + jobId); - } catch (Exception e) { - if (e instanceof RuntimeException) { - throw (RuntimeException) e; - } - throw new RuntimeException(e); - } - } - - private String[] getCsvArray(TankResult result) { - String[] ret = new String[FIELDS.length]; - ret[0] = ReportUtil.getTimestamp(result.getTimeStamp()); - ret[1] = result.getJobId(); - ret[2] = result.getInstanceId(); - ret[3] = result.getRequestName(); - ret[3] = Integer.toString(result.getStatusCode()); - ret[3] = Integer.toString(result.getResponseTime()); - ret[3] = Integer.toString(result.getResponseSize()); - ret[3] = Boolean.toString(result.isError()); - - // DatabaseKeys.IS_ERROR_KEY.getShortKey() - return ret; - } - - private boolean skipDate(Date date, Date start, Date end) { - boolean ret = false; - if (start != null && date.before(start)) { - ret = true; - } else if (end != null && date.after(end)) { - ret = true; - } - return ret; - } - - /** - * @param loggingKey - * @param periodDate - * @return - */ - private DescriptiveStatistics getBucketStats(String loggingKey, int period, Date periodDate) { - Map map = bucketItems.computeIfAbsent(loggingKey, k -> new HashMap()); - BucketDataItem bucketDataItem = map.get(periodDate); - if (bucketDataItem == null) { - bucketDataItem = new BucketDataItem(period, periodDate, new DescriptiveStatistics()); - map.put(periodDate, bucketDataItem); - } - return bucketDataItem.getStats(); - } - - /** - * @return the summaryResults - */ - public Map getSummaryResults() { - return summaryResults; - } - - /** - * @return the bucketItems - */ - public Map> getBucketItems() { - return bucketItems; - } - -} diff --git a/reporting/db/src/main/java/com/intuit/tank/persistence/databases/S3Datasource.java b/reporting/db/src/main/java/com/intuit/tank/persistence/databases/S3Datasource.java deleted file mode 100644 index f05bf05fa..000000000 --- a/reporting/db/src/main/java/com/intuit/tank/persistence/databases/S3Datasource.java +++ /dev/null @@ -1,214 +0,0 @@ -package com.intuit.tank.persistence.databases; - -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.stream.Collectors; - -import com.intuit.tank.vm.settings.CloudCredentials; -import com.intuit.tank.vm.settings.CloudProvider; -import org.apache.commons.configuration.HierarchicalConfiguration; -import org.apache.commons.lang3.StringUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import com.intuit.tank.reporting.databases.IDatabase; -import com.intuit.tank.reporting.databases.Item; -import com.intuit.tank.reporting.databases.PagedDatabaseResult; -import com.intuit.tank.reporting.databases.TankDatabaseType; -import com.intuit.tank.results.TankResult; -import com.intuit.tank.vm.settings.TankConfig; -import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; -import software.amazon.awssdk.auth.credentials.AwsCredentials; -import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; -import software.amazon.awssdk.core.async.AsyncRequestBody; -import software.amazon.awssdk.core.exception.SdkClientException; -import software.amazon.awssdk.regions.providers.DefaultAwsRegionProviderChain; -import software.amazon.awssdk.services.s3.S3AsyncClient; -import software.amazon.awssdk.services.s3.model.ObjectCannedACL; -import software.amazon.awssdk.services.s3.model.PutObjectRequest; -import software.amazon.awssdk.services.s3.model.S3Exception; - -import jakarta.annotation.Nonnull; - -import static java.util.stream.Collectors.groupingBy; -import static java.util.stream.Collectors.toList; - -/** - * S3Datasource - * - * @author Kevin McGoldrick - * - */ -public class S3Datasource implements IDatabase { - private static final Logger LOG = LogManager.getLogger(S3Datasource.class); - - private S3AsyncClient s3Client; - private String hostname = "fail"; - private String metricString = ""; - private String tags = ""; - private String bucketName = ""; - - private HierarchicalConfiguration resultsProviderConfig = - new TankConfig().getVmManagerConfig().getResultsProviderConfig(); - - public S3Datasource() { - CloudCredentials creds = new TankConfig().getVmManagerConfig().getCloudCredentials(CloudProvider.amazon); - if (creds != null && StringUtils.isNotBlank(creds.getKey()) && StringUtils.isNotBlank(creds.getKeyId())) { - AwsCredentials credentials = AwsBasicCredentials.create(creds.getKeyId(), creds.getKey()); - this.s3Client = S3AsyncClient.builder().credentialsProvider(StaticCredentialsProvider.create(credentials)).build(); - } else { - this.s3Client = S3AsyncClient.builder().build(); - } - } - - @Override - public void initNamespace(String tableName) {} - - @Override - public void removeNamespace(String tableName) {} - - @Override - public void deleteForJob(String tableName, String jobId, boolean asynch) {} - - @Override - public boolean hasTable(String tableName) { - return true; - } - - @Override - public boolean hasJobData(String tableName, String jobId) { - return true; - } - - @Override - public void addTimingResults(String tableName, List results, boolean asynch) { - LOG.trace("Starting addTimingResults with " + results.size() + " items"); - if (resultsProviderConfig != null) { - try { - metricString = resultsProviderConfig.getString("metricString","test.tank.transaction"); - tags = resultsProviderConfig.getString("tags", ""); //Example "bu=ctg app=tto pool=agent service=tank env=prf" - bucketName = resultsProviderConfig.getString("bucket", "tank-test"); - hostname = InetAddress.getLocalHost().getHostName(); - } catch (UnknownHostException e) { - LOG.error("Failed to get hostname " + e.toString(), e); - } - } else { - LOG.error("Results Provider Config is Empty. Please update settings.xml to include S3Datasource Configuration"); - } - - String region = new DefaultAwsRegionProviderChain().getRegion().toString(); - - if (StringUtils.endsWith(bucketName, "-")) { - bucketName = bucketName.concat(region); - } - - StringBuilder sb = new StringBuilder(); - String jobId = results.get(0).getJobId(); - String instance = results.get(0).getInstanceId(); - long timestamp = results.get(results.size()-1).getTimeStamp().getTime() / 1000; - - try { - String tagsComplete = " source=" + hostname + - " instanceid=" + instance + - " location=" + region + - " " + tags + - " jobid=" + jobId + - System.getProperty("line.separator"); - - Map> grouped = results.stream() - .collect(groupingBy(TankResult::getRequestName, - Collectors.mapping(TankResult::getResponseTime, toList()))); - LOG.trace("Sorted into " + grouped.size() + " request name groups"); - - for (Map.Entry> entry : grouped.entrySet()) { - String requestName = entry.getKey(); - List groupResults = entry.getValue(); - int size = groupResults.size(); - long sum = groupResults.stream().mapToInt(Integer::intValue).sum(); - Collections.sort(groupResults); - Integer[] sortedList = groupResults.toArray(new Integer[0]); - long average = sum / size; - int fiftieth = (size/2); - if (fiftieth >= 1) fiftieth--; - int ninetieth = Math.round(size * 0.9f); - if (ninetieth >= 1) ninetieth--; - int ninetynineth = Math.round(size * 0.99f); - if (ninetynineth >= 1) ninetynineth--; - sb.append(metricString + ".resp_time.min " + sortedList[0] + " " + timestamp + " transaction=" + requestName) - .append(tagsComplete) - .append(metricString + ".resp_time.avg " + average + " " + timestamp + " transaction=" + requestName) - .append(tagsComplete) - .append(metricString + ".resp_time.max " + sortedList[size - 1] + " " + timestamp + " transaction=" + requestName) - .append(tagsComplete) - .append(metricString + ".resp_time.tp_50 " + sortedList[fiftieth] + " " + timestamp + " transaction=" + requestName) - .append(tagsComplete) - .append(metricString + ".resp_time.tp_90 " + sortedList[ninetieth] + " " + timestamp + " transaction=" + requestName) - .append(tagsComplete) - .append(metricString + ".resp_time.tp_99 " + sortedList[ninetynineth] + " " + timestamp + " transaction=" + requestName) - .append(tagsComplete) - .append(metricString + ".rpi " + size + " " + timestamp + " transaction=" + requestName) - .append(tagsComplete); - } - LOG.trace("Sending to S3: " + sb.toString()); - PutObjectRequest.Builder request = PutObjectRequest.builder() - .bucket(bucketName) - .key("TANK-AgentData-" + UUID.randomUUID() + ".log") - .acl(ObjectCannedACL.BUCKET_OWNER_FULL_CONTROL); - s3Client.putObject(request.build(), AsyncRequestBody.fromString(sb.toString())); - } catch (SdkClientException ase) { - LOG.error("SdkClientException: which " + - "means your request made it " + - "to Amazon S3, but was rejected with an error response" + - " for some reason. bucket=" + bucketName + - "," + ase.getMessage(), ase); - } catch (S3Exception ace) { - LOG.error("S3Exception: which " + - "means the client encountered " + - "an internal error while trying to " + - "communicate with S3, " + - "such as not being able to access the network. bucket=" + - bucketName + "," + ace.getMessage(), ace); - } catch (Exception e) { - LOG.error("Error: " + e.getMessage(), e); - } - } - - @Override - public Set getTables(String regex) { - // TODO Auto-generated method stub - return null; - } - - @Override - public void addItems(String tableName, List items, boolean asynch) { - // TODO Auto-generated method stub - - } - - @Nonnull - @Override - public List getItems(String tableName, String minRange, String maxRange, String instanceId, String... jobId) { - return new ArrayList<>(); - } - - @Override - public PagedDatabaseResult getPagedItems(String tableName, - Object nextToken, String minRange, String maxRange, - String instanceId, String jobId) { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getDatabaseName(TankDatabaseType type, String jobId) { - // TODO Auto-generated method stub - return bucketName; - } - -} diff --git a/reporting/db/src/main/java/com/intuit/tank/persistence/databases/WavefrontDatasource.java b/reporting/db/src/main/java/com/intuit/tank/persistence/databases/WavefrontDatasource.java deleted file mode 100644 index 8ae6d7cc0..000000000 --- a/reporting/db/src/main/java/com/intuit/tank/persistence/databases/WavefrontDatasource.java +++ /dev/null @@ -1,243 +0,0 @@ -package com.intuit.tank.persistence.databases; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintWriter; -import java.net.InetAddress; -import java.net.Socket; -import java.net.UnknownHostException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Set; - -import org.apache.commons.configuration.HierarchicalConfiguration; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.math.NumberUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import com.intuit.tank.reporting.databases.IDatabase; -import com.intuit.tank.reporting.databases.Item; -import com.intuit.tank.reporting.databases.PagedDatabaseResult; -import com.intuit.tank.reporting.databases.TankDatabaseType; -import com.intuit.tank.results.TankResult; -import com.intuit.tank.vm.settings.TankConfig; - -import jakarta.annotation.Nonnull; - -/** - * WavefrontDatasource - * - * @author Kevin McGoldrick - * - */ -public class WavefrontDatasource implements IDatabase { - private static final Logger LOG = LogManager.getLogger(WavefrontDatasource.class); - - InetAddress ip; - private String hostname = "fail"; - private String enviornemnt = "qa"; - private String metricString = "ctg.tank.transaction"; - private String host = "wavefrontproxy-test.intuit.net"; - private int port = 2878; - - private TankConfig config = new TankConfig(); - private HierarchicalConfiguration resultsProviderConfig = config.getVmManagerConfig().getResultsProviderConfig(); - - @Override - public void initNamespace(String tableName) { - // TODO Auto-generated method stub - } - - @Override - public void removeNamespace(String tableName) { - // TODO Auto-generated method stub - - } - - @Override - public void deleteForJob(String tableName, String jobId, boolean asynch) { - // TODO Auto-generated method stub - - } - - @Override - public boolean hasTable(String tableName) { - // TODO Auto-generated method stub - return true; - } - - @Override - public boolean hasJobData(String tableName, String jobId) { - // TODO Auto-generated method stub - return true; - } - - @SuppressWarnings("unchecked") - @Override - public void addTimingResults(String tableName, List results, boolean asynch) { - if (resultsProviderConfig != null) { - try { - hostname = ip.getHostName(); - enviornemnt = config.getInstanceName(); - if (StringUtils.equalsIgnoreCase(enviornemnt, "prod")) { - enviornemnt = "prd"; - } else if (StringUtils.equalsIgnoreCase(enviornemnt, "qa")) { - enviornemnt = "qal"; - } else if (StringUtils.equalsIgnoreCase(enviornemnt, "canada")) { - enviornemnt = "can"; - } else { - enviornemnt = "prf"; - } - metricString = resultsProviderConfig.getString("metricString"); - host = resultsProviderConfig.getString("wavefrontHost"); - String s = resultsProviderConfig.getString("wavefrontPort"); - if (NumberUtils.isDigits(s)) { - port = Integer.parseInt(s); - } - } catch (Exception e) { - LOG.error("Failed to get Wavefront parameters " + e.toString()); - } - } - String jobId = results.get(0).getJobId(); - String instance = results.get(0).getInstanceId(); - long l = results.get(results.size()-1).getTimeStamp().getTime() / 1000; - Collections.sort(results); - - StringBuilder sb = new StringBuilder(); - List groupResults = new ArrayList(); - String requestName = ""; - long sum = 0; - for (TankResult metric: results) { - if (StringUtils.equalsIgnoreCase(metric.getRequestName(), requestName)) { //Middle of the Group - groupResults.add(Long.valueOf(metric.getResponseTime())); - sum += metric.getResponseTime(); - } else if (StringUtils.isEmpty(requestName)) { // Handles the first time through // - requestName = metric.getRequestName(); - sum = metric.getResponseTime(); - groupResults.add(Long.valueOf(sum)); - } else { // Handles the last time through of the group// - int size = groupResults.size(); - Collections.sort(groupResults); - Long[] sortedList = groupResults.toArray(new Long[size]); - long average = sum / size; - int fiftieth = (size/2); - if (fiftieth >= 1) fiftieth--; - float ninety = 0.9f; - int ninetieth = Math.round(size * ninety); - if (ninetieth >= 1) ninetieth--; - float ninetynine = 0.99f; - int ninetynineth = Math.round(size * ninetynine); - if (ninetynineth >= 1) ninetynineth--; - sb.append(metricString + ".resp_time.min " + sortedList[0] + " " + l) - .append(" source=" + hostname + " instanceid=" + instance + " transaction=" + requestName) - .append(" bu=ctg app=tnk pool=agent env=" + enviornemnt + " jobid=" + jobId + System.getProperty("line.separator")) - .append(metricString + ".resp_time.avg " + average + " " + l) - .append(" source=" + hostname + " instanceid=" + instance + " transaction=" + requestName) - .append(" bu=ctg app=tnk pool=agent env=" + enviornemnt + " jobid=" + jobId + System.getProperty("line.separator")) - .append(metricString + ".resp_time.max " + sortedList[size - 1] + " " + l) - .append(" source=" + hostname + " instanceid=" + instance + " transaction=" + requestName) - .append(" bu=ctg app=tnk pool=agent env=" + enviornemnt + " jobid=" + jobId + System.getProperty("line.separator")) - .append(metricString + ".resp_time.tp_50 " + sortedList[fiftieth] + " " + l) - .append(" source=" + hostname + " instanceid=" + instance + " transaction=" + requestName) - .append(" bu=ctg app=tnk pool=agent env=" + enviornemnt + " jobid=" + jobId + System.getProperty("line.separator")) - .append(metricString + ".resp_time.tp_90 " + sortedList[ninetieth] + " " + l) - .append(" source=" + hostname + " instanceid=" + instance + " transaction=" + requestName) - .append(" bu=ctg app=tnk pool=agent env=" + enviornemnt + " jobid=" + jobId + System.getProperty("line.separator")) - .append(metricString + ".resp_time.tp_99 " + sortedList[ninetynineth] + " " + l) - .append(" source=" + hostname + " instanceid=" + instance + " transaction=" + requestName) - .append(" bu=ctg app=tnk pool=agent env=" + enviornemnt + " jobid=" + jobId + System.getProperty("line.separator")) - .append(metricString + ".rpi " + size + " " + l) - .append(" source=" + hostname + " instanceid=" + instance + " transaction=" + requestName) - .append(" bu=ctg app=tnk pool=agent env=" + enviornemnt + " jobid=" + jobId + System.getProperty("line.separator")); - requestName = metric.getRequestName(); - groupResults.clear(); - groupResults.add(Long.valueOf(metric.getResponseTime())); - sum = 0; - } - } // Get that last one // - int size = groupResults.size(); - Collections.sort(groupResults); - Long[] sortedList = groupResults.toArray(new Long[size]); - long average = sum / size; - int fiftieth = (size/2); - if (fiftieth >= 1) fiftieth--; - float ninety = 0.9f; - int ninetieth = Math.round(size * ninety); - if (ninetieth >= 1) ninetieth--; - float ninetynine = 0.99f; - int ninetynineth = Math.round(size * ninetynine); - if (ninetynineth >= 1) ninetynineth--; - sb.append(metricString + ".resp_time.min " + sortedList[0] + " " + l) - .append(" source=" + hostname + " instanceid=" + instance + " transaction=" + requestName) - .append(" bu=ctg app=tnk pool=agent env=" + enviornemnt + " jobid=" + jobId + System.getProperty("line.separator")) - .append(metricString + ".resp_time.avg " + average + " " + l) - .append(" source=" + hostname + " instanceid=" + instance + " transaction=" + requestName) - .append(" bu=ctg app=tnk pool=agent env=" + enviornemnt + " jobid=" + jobId + System.getProperty("line.separator")) - .append(metricString + ".resp_time.max " + sortedList[size - 1] + " " + l) - .append(" source=" + hostname + " instanceid=" + instance + " transaction=" + requestName) - .append(" bu=ctg app=tnk pool=agent env=" + enviornemnt + " jobid=" + jobId + System.getProperty("line.separator")) - .append(metricString + ".resp_time.tp_50 " + sortedList[fiftieth] + " " + l) - .append(" source=" + hostname + " instanceid=" + instance + " transaction=" + requestName) - .append(" bu=ctg app=tnk pool=agent env=" + enviornemnt + " jobid=" + jobId + System.getProperty("line.separator")) - .append(metricString + ".resp_time.tp_90 " + sortedList[ninetieth] + " " + l) - .append(" source=" + hostname + " instanceid=" + instance + " transaction=" + requestName) - .append(" bu=ctg app=tnk pool=agent env=" + enviornemnt + " jobid=" + jobId + System.getProperty("line.separator")) - .append(metricString + ".resp_time.tp_99 " + sortedList[ninetynineth] + " " + l) - .append(" source=" + hostname + " instanceid=" + instance + " transaction=" + requestName) - .append(" bu=ctg app=tnk pool=agent env=" + enviornemnt + " jobid=" + jobId + System.getProperty("line.separator")) - .append(metricString + ".rpi " + size + " " + l) - .append(" source=" + hostname + " instanceid=" + instance + " transaction=" + requestName) - .append(" bu=ctg app=tnk pool=agent env=" + enviornemnt + " jobid=" + jobId + System.getProperty("line.separator")); - - try { - Socket socket = new Socket(host, port); - OutputStream s = socket.getOutputStream(); - PrintWriter out = new PrintWriter(s, true); - out.print(sb); - out.flush(); - out.close(); - socket.close(); - } catch (UnknownHostException e) { - LOG.error("Unknown host: " + host); - } catch (IOException e) { - LOG.error("Error while writing data to wavefront: " + e.getMessage(), e); - } catch (Exception e) { - LOG.error("Error: " + e.getMessage(), e); - } - } - - @Override - public Set getTables(String regex) { - // TODO Auto-generated method stub - return null; - } - - @Override - public void addItems(String tableName, List items, boolean asynch) { - // TODO Auto-generated method stub - - } - - @Nonnull - @Override - public List getItems(String tableName, String minRange, String maxRange, String instanceId, String... jobId) { - return new ArrayList<>(); - } - - @Override - public PagedDatabaseResult getPagedItems(String tableName, - Object nextToken, String minRange, String maxRange, - String instanceId, String jobId) { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getDatabaseName(TankDatabaseType type, String jobId) { - // TODO Auto-generated method stub - return host; - } - -} diff --git a/reporting/db/src/main/java/com/intuit/tank/reporting/db/DatabaseResultsReader.java b/reporting/db/src/main/java/com/intuit/tank/reporting/db/DatabaseResultsReader.java deleted file mode 100644 index 40613c660..000000000 --- a/reporting/db/src/main/java/com/intuit/tank/reporting/db/DatabaseResultsReader.java +++ /dev/null @@ -1,198 +0,0 @@ -/** - * Copyright 2011 Intuit Inc. All Rights Reserved - */ -package com.intuit.tank.reporting.db; - -import java.text.ParseException; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import org.apache.commons.configuration.HierarchicalConfiguration; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import com.intuit.tank.persistence.databases.DataBaseFactory; -import com.intuit.tank.persistence.databases.DatabaseKeys; -import com.intuit.tank.reporting.api.PagedTimingResults; -import com.intuit.tank.reporting.api.ResultsReader; -import com.intuit.tank.reporting.api.TPSInfo; -import com.intuit.tank.reporting.databases.Attribute; -import com.intuit.tank.reporting.databases.IDatabase; -import com.intuit.tank.reporting.databases.Item; -import com.intuit.tank.reporting.databases.PagedDatabaseResult; -import com.intuit.tank.reporting.databases.TankDatabaseType; -import com.intuit.tank.results.TankResult; -import com.intuit.tank.results.TankResultBuilder; -import com.intuit.tank.vm.common.util.ReportUtil; -import com.intuit.tank.vm.settings.TankConfig; - -/** - * DatabaseResultsReader - * - * @author dangleton - * - */ -public class DatabaseResultsReader implements ResultsReader { - - private static final Logger LOG = LogManager.getLogger(DatabaseResultsReader.class); - - private IDatabase db; - - public DatabaseResultsReader() { - db = DataBaseFactory.getDatabase(); - } - - /** - * - * {@inheritDoc} - */ - @Override - public List getAllTimingResults(String jobId) { - Object nextToken = null; - List ret = new ArrayList(); - do { - PagedTimingResults results = getPagedTimingResults(jobId, nextToken); - ret.addAll(results.getResults()); - nextToken = results.getNextToken(); - } while (nextToken != null); - return ret; - } - - /** - * - * {@inheritDoc} - */ - @Override - public PagedTimingResults getPagedTimingResults(String jobId, Object nextToken) { - String tableName = db.getDatabaseName(TankDatabaseType.timing, jobId); - List results = new ArrayList(); - try { - PagedDatabaseResult pagedItems = db.getPagedItems(tableName, nextToken, null, null, null, jobId); - results = pagedItems.getItems().stream().map(this::ItemToTankResult).collect(Collectors.toList()); - nextToken = pagedItems.getNextToken(); - } catch (NullPointerException npe) { //Ignore - } catch (Exception e) { - if (e instanceof RuntimeException) { - throw (RuntimeException) e; - } - throw new RuntimeException(e); - } - return new PagedTimingResults(nextToken, results); - } - - /** - * - * {@inheritDoc} - */ - @Override - public boolean hasTimingData(String jobId) { - String tableName = db.getDatabaseName(TankDatabaseType.timing, jobId); - return db.hasJobData(tableName, jobId); - } - - private TankResult ItemToTankResult(Item item) { - TankResultBuilder builder = TankResultBuilder.tankResult(); - for (Attribute attr : item.getAttributes()) { - try { - if (DatabaseKeys.TIMESTAMP_KEY.getShortKey().equals(attr.getName())) { - builder.withTimestamp(ReportUtil.parseTimestamp(attr.getValue())); - } else if (DatabaseKeys.JOB_ID_KEY.getShortKey().equals(attr.getName())) { - builder.withJobId(attr.getValue()); - } else if (DatabaseKeys.INSTANCE_ID_KEY.getShortKey().equals(attr.getName())) { - builder.withInstanceId(attr.getValue()); - } else if (DatabaseKeys.LOGGING_KEY_KEY.getShortKey().equals(attr.getName())) { - builder.withRequestName(attr.getValue()); - } else if (DatabaseKeys.STATUS_CODE_KEY.getShortKey().equals(attr.getName())) { - builder.withStatusCode(Integer.parseInt(attr.getValue())); - } else if (DatabaseKeys.RESPONSE_TIME_KEY.getShortKey().equals(attr.getName())) { - builder.withResponseTime(Integer.parseInt(attr.getValue())); - } else if (DatabaseKeys.RESPONSE_SIZE_KEY.getShortKey().equals(attr.getName())) { - builder.withResponseSize(Integer.parseInt(attr.getValue())); - } else if (DatabaseKeys.IS_ERROR_KEY.getShortKey().equals(attr.getName())) { - builder.withError(Boolean.valueOf(attr.getValue())); - } - } catch (Exception e) { - LOG.warn("Error processing item: " + e); - } - } - return builder.build(); - } - - @Override - public void deleteTimingForJob(String jobId, boolean asynch) { - - String tableName = db.getDatabaseName(TankDatabaseType.timing, jobId); - db.deleteForJob(tableName, jobId, asynch); - - } - - @Override - public void config(HierarchicalConfiguration config) { - // nothing to do - } - - @Override - public Map> getTpsMapForInstance(Date minDate, String jobId, String instanceId) { - return getTpsMap(minDate, instanceId, jobId); - } - - @Override - public Map> getTpsMapForJob(Date minDate, String... jobId) { - return getTpsMap(minDate, null, jobId); - } - - private Map> getTpsMap(Date minDate, String instanceId, String... jobIds) { - Map> ret = new HashMap>(); - try { - String tpsTableName = new TankConfig().getInstanceName() + "_tps"; - if (db.hasTable(tpsTableName)) { - - if (jobIds != null && jobIds.length > 0) { - - String dateString = null; - if (minDate != null) { - dateString = ReportUtil.getTimestamp(minDate); - } - List items = db.getItems(tpsTableName, dateString, null, instanceId, jobIds); - for (Item item : items) { - String loggingKey = null; - Date timestamp = null; - int transactions = 0; - int period = 0; - - for (Attribute att : item.getAttributes()) { - if (DatabaseKeys.LOGGING_KEY_KEY.getShortKey().equals(att.getName())) { - loggingKey = att.getValue(); - } else if (DatabaseKeys.TIMESTAMP_KEY.getShortKey().equals(att.getName())) { - try { - timestamp = ReportUtil.parseTimestamp(att.getValue()); - } catch (ParseException e) { - LOG.error("Error processing timestamp " + att.getValue() + ":" + e); - } - } else if (DatabaseKeys.TRANSACTIONS_KEY.getShortKey().equals(att.getName())) { - transactions = Integer.parseInt(att.getValue()); - } else if (DatabaseKeys.PERIOD_KEY.getShortKey().equals(att.getName())) { - period = Integer.parseInt(att.getValue()); - } - } - TPSInfo info = new TPSInfo(timestamp, loggingKey, transactions, period); - Map map = ret.computeIfAbsent(timestamp, k -> new HashMap()); - TPSInfo existing = map.get(loggingKey); - if (existing != null) { - info = existing.add(info); - } - map.put(loggingKey, info); - } - } - } - } catch (Exception e) { - LOG.error("Error getting TPS map: " + e, e); - } - return ret; - } - -} diff --git a/reporting/db/src/main/java/com/intuit/tank/reporting/db/DatabaseResultsReporter.java b/reporting/db/src/main/java/com/intuit/tank/reporting/db/DatabaseResultsReporter.java deleted file mode 100644 index ccdfc90f8..000000000 --- a/reporting/db/src/main/java/com/intuit/tank/reporting/db/DatabaseResultsReporter.java +++ /dev/null @@ -1,150 +0,0 @@ -/** - * Copyright 2011 Intuit Inc. All Rights Reserved - */ -package com.intuit.tank.reporting.db; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.Executors; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; - -import com.google.common.collect.ImmutableMap; -import org.apache.commons.configuration.HierarchicalConfiguration; -import org.apache.commons.lang3.StringUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import com.intuit.tank.persistence.databases.DataBaseFactory; -import com.intuit.tank.persistence.databases.DatabaseKeys; -import com.intuit.tank.reporting.api.ResultsReporter; -import com.intuit.tank.reporting.api.TPSInfo; -import com.intuit.tank.reporting.api.TPSInfoContainer; -import com.intuit.tank.reporting.databases.Attribute; -import com.intuit.tank.reporting.databases.IDatabase; -import com.intuit.tank.reporting.databases.Item; -import com.intuit.tank.reporting.databases.TankDatabaseType; -import com.intuit.tank.results.TankResult; -import com.intuit.tank.vm.common.util.ReportUtil; -import com.intuit.tank.vm.settings.TankConfig; -import org.apache.logging.log4j.message.ObjectMessage; - -/** - * DatabaseResultsReporter - * - * @author dangleton - * - */ -public class DatabaseResultsReporter implements ResultsReporter { - - private static final Logger LOG = LogManager.getLogger(DatabaseResultsReporter.class); - - private static final ThreadPoolExecutor EXECUTOR = - new ThreadPoolExecutor(10, 50, 60, TimeUnit.SECONDS, - new ArrayBlockingQueue(50), Executors.defaultThreadFactory(), - new ThreadPoolExecutor.DiscardOldestPolicy()); - - private String tpsTableName; - private String timingTableName; - private IDatabase db; - - public DatabaseResultsReporter() { - db = DataBaseFactory.getDatabase(); - } - - /** - * {@inheritDoc} - */ - @Override - public void sendTpsResults(final String jobId, final String instanceId, final TPSInfoContainer container, - boolean async) { - - Runnable task = () -> { - try { - List items = container.getTpsInfos().stream() - .map(info -> createItem(jobId, instanceId, info)) - .collect(Collectors.toList()); - if (!items.isEmpty()) { - String tableName = getTpsTableName(db); - db.addItems(tableName, items, false); - } - } catch (Exception t) { - LOG.error("Error adding results: " + t.getMessage(), t); - throw new RuntimeException(t); - } - }; - if (async) { - EXECUTOR.execute(task); - } else { - task.run(); - } - - } - - /** - * {@inheritDoc} - */ - @Override - public void sendTimingResults(String jobId, String instanceId, List results, boolean async) { - String tableName = getTimingTableName(db, jobId); - if (results.size() != 0 && tableName != null) { - final List list; - synchronized (results) { - list = new ArrayList(results); - results.clear(); - } - DataBaseFactory.getDatabase().addTimingResults(tableName, list, async); - } - - } - - private Item createItem(String jobId, String instanceId, TPSInfo info) { - Item item = new Item(); - List attributes = new ArrayList(); - String ts = ReportUtil.getTimestamp(info.getTimestamp()); - addAttribute(attributes, DatabaseKeys.TIMESTAMP_KEY.getShortKey(), ts); - addAttribute(attributes, DatabaseKeys.JOB_ID_KEY.getShortKey(), jobId); - addAttribute(attributes, DatabaseKeys.INSTANCE_ID_KEY.getShortKey(), instanceId); - addAttribute(attributes, DatabaseKeys.LOGGING_KEY_KEY.getShortKey(), info.getKey()); - addAttribute(attributes, DatabaseKeys.PERIOD_KEY.getShortKey(), Integer.toString(info.getPeriodInSeconds())); - addAttribute(attributes, DatabaseKeys.TRANSACTIONS_KEY.getShortKey(), Integer.toString(info.getTransactions())); - item.setAttributes(attributes); - String name = instanceId - + "_" + jobId - + "_" + info.getKey() - + "_" + ts; - item.setName(name); - return item; - } - - public static void addAttribute(List attributes, String key, String value) { - if (value == null) { - value = ""; - } - attributes.add(new Attribute(key, value)); - } - - @Override - public void config(HierarchicalConfiguration config) { - // nothing to configure - } - - private String getTimingTableName(IDatabase db, String jobId) { - if (StringUtils.isBlank(timingTableName)) { - timingTableName = db.getDatabaseName(TankDatabaseType.timing, jobId); - db.initNamespace(timingTableName); - } - return timingTableName; - } - - private String getTpsTableName(IDatabase db) { - if (StringUtils.isBlank(tpsTableName)) { - tpsTableName = new TankConfig().getInstanceName() + "_tps"; - db.initNamespace(tpsTableName); - } - return tpsTableName; - } - -} diff --git a/reporting/db/src/main/resources/META-INF/beans.xml b/reporting/db/src/main/resources/META-INF/beans.xml deleted file mode 100644 index fd5a160e6..000000000 --- a/reporting/db/src/main/resources/META-INF/beans.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - diff --git a/reporting/db/src/test/java/com/intuit/tank/persistence/databases/AmazonDynamoDatabaseTest.java b/reporting/db/src/test/java/com/intuit/tank/persistence/databases/AmazonDynamoDatabaseTest.java deleted file mode 100644 index a482f8d63..000000000 --- a/reporting/db/src/test/java/com/intuit/tank/persistence/databases/AmazonDynamoDatabaseTest.java +++ /dev/null @@ -1,194 +0,0 @@ -package com.intuit.tank.persistence.databases; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.List; - -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.core.LoggerContext; -import org.apache.logging.log4j.core.config.Configuration; -import org.junit.jupiter.api.BeforeEach; - -import com.intuit.tank.reporting.databases.Attribute; -import com.intuit.tank.reporting.databases.Item; -import com.intuit.tank.results.TankResult; -import com.intuit.tank.results.TankResultBuilder; -import com.intuit.tank.test.TestGroups; -import com.intuit.tank.vm.common.util.ReportUtil; -import org.junit.jupiter.api.Tag; -import org.junit.jupiter.api.Test; -import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; -import software.amazon.awssdk.auth.credentials.AwsCredentials; -import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; -import software.amazon.awssdk.services.dynamodb.DynamoDbClient; -import software.amazon.awssdk.services.dynamodb.model.ListTablesResponse; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class AmazonDynamoDatabaseTest { - - private static final String TEST_JOB_ID = "TestJob1"; - private static final String TEST_TABLE = "TestTable"; - private static final int NUM_ENTRIES = 100; - private AmazonDynamoDatabaseDocApi db; - private DynamoDbClient dynamoDbClient; - - @BeforeEach - public void init() { - LoggerContext ctx = (LoggerContext) LogManager.getContext(false); - Configuration config = ctx.getConfiguration(); - config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME).setLevel(Level.INFO); - ctx.updateLoggers(); // This causes all Loggers to refetch information from their LoggerConfig. - } - - @BeforeEach - public void before() { - AwsCredentials credentials = AwsBasicCredentials.create(System.getProperty("AWS_SECRET_KEY_ID"), - System.getProperty("AWS_SECRET_KEY")); - dynamoDbClient = DynamoDbClient.builder().credentialsProvider(StaticCredentialsProvider.create(credentials)).build(); - db = new AmazonDynamoDatabaseDocApi(dynamoDbClient); - } - -// @BeforeMethod - public void cleanTables() { - if (db != null) { - try { - db.removeNamespace(TEST_TABLE); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - @Test - @Tag(TestGroups.EXPERIMENTAL) - public void testListTables() { - ListTablesResponse listTables = dynamoDbClient.listTables(); - for (String s : listTables.tableNames()) { - System.out.println(s); - } - - } - - @Test - @Tag(TestGroups.EXPERIMENTAL) - public void testCreateDelete() { - db.initNamespace(TEST_TABLE); - boolean hasTable = db.hasTable(TEST_TABLE); - assertEquals(true, hasTable); - db.removeNamespace(TEST_TABLE); - } - - @Test - @Tag(TestGroups.EXPERIMENTAL) - public void testInsertTiming() { - db.initNamespace(TEST_TABLE); - boolean hasTable = db.hasTable(TEST_TABLE); - - assertEquals(true, hasTable); - boolean hasJobData = db.hasJobData(TEST_TABLE, TEST_JOB_ID); - assertEquals(false, hasJobData); - List results = getResults(NUM_ENTRIES); - db.addTimingResults(TEST_TABLE, results, false); - List items = db.getItems(TEST_TABLE, TEST_JOB_ID, null, null, null); - assertEquals(NUM_ENTRIES , items.size()); - printItems(items); - hasJobData = db.hasJobData(TEST_TABLE, TEST_JOB_ID); - assertEquals(true, hasJobData); - String start = ReportUtil.getTimestamp(results.get(10).getTimeStamp()); - String end = ReportUtil.getTimestamp(results.get(90).getTimeStamp()); - items = db.getItems(TEST_TABLE, TEST_JOB_ID, start, null, null); - assertEquals(NUM_ENTRIES - 10 , items.size()); - items = db.getItems(TEST_TABLE, TEST_JOB_ID, null, end, null); - assertEquals(NUM_ENTRIES - 10 , items.size()); - items = db.getItems(TEST_TABLE, TEST_JOB_ID, start, end, null); - assertEquals(NUM_ENTRIES - 20 , items.size()); - } - - @Test - @Tag(TestGroups.EXPERIMENTAL) - public void testInsertTps() { - db.initNamespace(TEST_TABLE); - int numJobs = 3; - boolean hasTable = db.hasTable(TEST_TABLE); - assertEquals(true, hasTable); - List results = getTpsItems(NUM_ENTRIES, numJobs); - db.addItems(TEST_TABLE, results, false); - List items = db.getItems(TEST_TABLE, null, null, null, null); - assertEquals(numJobs * NUM_ENTRIES, items.size()); - for (int i = 0; i < numJobs; i++) { - items = db.getItems(TEST_TABLE, Integer.toString(i), null, null, null); - assertEquals(NUM_ENTRIES, items.size()); - printItems(items); - db.deleteForJob(TEST_TABLE, Integer.toString(i), false); - items = db.getItems(TEST_TABLE, Integer.toString(i), null, null, null); - assertEquals(0, items.size()); - } - } - - private void printItems(List items) { - for (Item item : items) { - System.out.println(item.getName()); - for (Attribute attr : item.getAttributes()) { - System.out.println(attr.getName() + " = " + attr.getValue()); - } - } - } - - private List getTpsItems(int numItems, int numJobs) { - List ret = new ArrayList(); - for (int jobId = 0; jobId < numJobs; jobId++) { - for (int i = 0; i < numItems; i++) { - Item item = new Item(); - String testJobId = Integer.toString(jobId); - List attributes = new ArrayList(); - Date date = new Date(); - String ts = ReportUtil.getTimestamp(date); - addAttribute(attributes, DatabaseKeys.TIMESTAMP_KEY.getShortKey(), ts); - addAttribute(attributes, DatabaseKeys.JOB_ID_KEY.getShortKey(), testJobId); - addAttribute(attributes, DatabaseKeys.INSTANCE_ID_KEY.getShortKey(), "TestInstanceID"); - addAttribute(attributes, DatabaseKeys.LOGGING_KEY_KEY.getShortKey(), "TestLoggingKey"); - addAttribute(attributes, DatabaseKeys.PERIOD_KEY.getShortKey(), "15"); - addAttribute(attributes, DatabaseKeys.TRANSACTIONS_KEY.getShortKey(), "10"); - item.setAttributes(attributes); - String name = "TestInstanceID" - + "_" + testJobId - + "_" + "TestLoggingKey" - + "_" + date; - item.setName(name); - ret.add(item); - } - } - return ret; - } - - private void addAttribute(List attributes, String key, String value) { - if (value == null) { - value = ""; - } - attributes.add(new Attribute(key, value)); - } - - private List getResults(int numItems) { - List ret = new ArrayList(); - Calendar c = Calendar.getInstance(); - c.add(Calendar.SECOND, -numItems); - for (int i = 0; i < numItems; i++) { - c.add(Calendar.SECOND, 1); - TankResultBuilder builder = new TankResultBuilder(); - builder.withJobId(TEST_JOB_ID); - builder.withError(false); - builder.withRequestName("TestRequest"); - builder.withResponseSize(1); - builder.withResponseTime(2000); - builder.withStatusCode(200); - TankResult tankResult = builder.build(); - tankResult.setTimeStamp(c.getTime()); - ret.add(tankResult); - } - return ret; - } - -} diff --git a/reporting/db/src/test/java/com/intuit/tank/persistence/databases/BucketDataItemTest.java b/reporting/db/src/test/java/com/intuit/tank/persistence/databases/BucketDataItemTest.java deleted file mode 100644 index ca2a26c9b..000000000 --- a/reporting/db/src/test/java/com/intuit/tank/persistence/databases/BucketDataItemTest.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.intuit.tank.persistence.databases; - -/* - * #%L - * Reporting database support - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -import java.text.DateFormat; -import java.util.Date; - -import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; -import org.junit.jupiter.api.*; - -import com.intuit.tank.persistence.databases.BucketDataItem; - -import static org.junit.jupiter.api.Assertions.*; - -/** - * The class BucketDataItemTest contains tests for the class {@link BucketDataItem}. - * - * @generatedBy CodePro at 9/10/14 10:32 AM - */ -public class BucketDataItemTest { - /** - * Run the BucketDataItem(int,Date,DescriptiveStatistics) constructor test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:32 AM - */ - @Test - public void testBucketDataItem_1() - throws Exception { - int period = 1; - Date startTime = new Date(); - DescriptiveStatistics stats = new DescriptiveStatistics(); - - BucketDataItem result = new BucketDataItem(period, startTime, stats); - - assertNotNull(result); - assertEquals(1, result.getPeriod()); - } - - /** - * Run the int getPeriod() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:32 AM - */ - @Test - public void testGetPeriod_1() - throws Exception { - BucketDataItem fixture = new BucketDataItem(1, new Date(), new DescriptiveStatistics()); - - int result = fixture.getPeriod(); - - assertEquals(1, result); - } - - /** - * Run the Date getStartTime() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:32 AM - */ - @Test - public void testGetStartTime_1() - throws Exception { - BucketDataItem fixture = new BucketDataItem(1, new Date(), new DescriptiveStatistics()); - - Date result = fixture.getStartTime(); - - assertNotNull(result); - } - - /** - * Run the DescriptiveStatistics getStats() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:32 AM - */ - @Test - public void testGetStats_1() - throws Exception { - BucketDataItem fixture = new BucketDataItem(1, new Date(), new DescriptiveStatistics()); - - DescriptiveStatistics result = fixture.getStats(); - - assertNotNull(result); - assertEquals( - "DescriptiveStatistics:\nn: 0\nmin: NaN\nmax: NaN\nmean: NaN\nstd dev: NaN\nmedian: NaN\nskewness: NaN\nkurtosis: NaN\n", - result.toString()); - assertEquals(Double.NaN, result.getMax(), 1.0); - assertEquals(Double.NaN, result.getVariance(), 1.0); - assertEquals(Double.NaN, result.getMean(), 1.0); - assertEquals(-1, result.getWindowSize()); - assertEquals(0.0, result.getSumsq(), 1.0); - assertEquals(Double.NaN, result.getKurtosis(), 1.0); - assertEquals(0.0, result.getSum(), 1.0); - assertEquals(Double.NaN, result.getSkewness(), 1.0); - assertEquals(Double.NaN, result.getPopulationVariance(), 1.0); - assertEquals(Double.NaN, result.getStandardDeviation(), 1.0); - assertEquals(Double.NaN, result.getGeometricMean(), 1.0); - assertEquals(0L, result.getN()); - assertEquals(Double.NaN, result.getMin(), 1.0); - } -} \ No newline at end of file diff --git a/reporting/db/src/test/java/com/intuit/tank/persistence/databases/DatabaseQueueTest.java b/reporting/db/src/test/java/com/intuit/tank/persistence/databases/DatabaseQueueTest.java deleted file mode 100644 index 6299c7028..000000000 --- a/reporting/db/src/test/java/com/intuit/tank/persistence/databases/DatabaseQueueTest.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.intuit.tank.persistence.databases; - -/* - * #%L - * Reporting database support - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -import org.junit.jupiter.api.*; - -import com.intuit.tank.persistence.databases.DatabaseQueue; - -import static org.junit.jupiter.api.Assertions.*; - -/** - * The class DatabaseQueueTest contains tests for the class {@link DatabaseQueue}. - * - * @generatedBy CodePro at 9/10/14 10:32 AM - */ -public class DatabaseQueueTest { - /** - * Run the DatabaseQueue clone() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:32 AM - */ - @Test() - public void testClone_1() - throws Exception { - DatabaseQueue fixture = DatabaseQueue.getInstance(); - - assertThrows(java.lang.CloneNotSupportedException.class, () -> fixture.clone()); - } - - /** - * Run the void execute(Runnable) method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:32 AM - */ - @Test - public void testExecute_1() - throws Exception { - DatabaseQueue fixture = DatabaseQueue.getInstance(); - Runnable runnable = new Thread(); - - fixture.execute(runnable); - - } - - /** - * Run the DatabaseQueue getInstance() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:32 AM - */ - @Test - public void testGetInstance_1() - throws Exception { - - DatabaseQueue result = DatabaseQueue.getInstance(); - - assertNotNull(result); - } -} \ No newline at end of file diff --git a/reporting/db/src/test/java/com/intuit/tank/persistence/databases/MetricsCalculatorTest.java b/reporting/db/src/test/java/com/intuit/tank/persistence/databases/MetricsCalculatorTest.java deleted file mode 100644 index d94d8d8ef..000000000 --- a/reporting/db/src/test/java/com/intuit/tank/persistence/databases/MetricsCalculatorTest.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Copyright 2011 Intuit Inc. All Rights Reserved - */ -package com.intuit.tank.persistence.databases; - -/* - * #%L - * Reporting database support - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -import java.util.Date; -import java.util.Map; - -import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.junit.jupiter.api.Test; - -/** - * MetricsCalculatorTest - * - * @author dangleton - * - */ -public class MetricsCalculatorTest { - private static final Logger LOG = LogManager.getLogger(MetricsCalculatorTest.class); - - /** - * Run the MetricsCalculator() constructor test. - * - * @generatedBy CodePro at 9/10/14 10:32 AM - */ - @Test - public void testMetricsCalculator_1() - throws Exception { - MetricsCalculator result = new MetricsCalculator(); - assertNotNull(result); - } - - /** - * Run the Map> getBucketItems() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:32 AM - */ - @Test - public void testGetBucketItems_1() - throws Exception { - MetricsCalculator fixture = new MetricsCalculator(); - - Map> result = fixture.getBucketItems(); - - assertNotNull(result); - assertEquals(0, result.size()); - } - - /** - * Run the Map getSummaryResults() method test. - * - * @throws Exception - * - * @generatedBy CodePro at 9/10/14 10:32 AM - */ - @Test - public void testGetSummaryResults_1() - throws Exception { - MetricsCalculator fixture = new MetricsCalculator(); - - Map result = fixture.getSummaryResults(); - - assertNotNull(result); - assertEquals(0, result.size()); - } -} diff --git a/reporting/local/pom.xml b/reporting/local/pom.xml deleted file mode 100644 index d12e3e7f2..000000000 --- a/reporting/local/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - 4.0.0 - - - com.intuit.tank - reporting-parent - 4.1.1-SNAPSHOT - - - reporting-local-storage - - jar - Reporting Rest support - - - - - ${project.groupId} - api - ${project.version} - - - - ${project.groupId} - reporting-api - ${project.version} - - - - - - - diff --git a/reporting/local/src/main/java/com/intuit/tank/reporting/local/ResultsStorage.java b/reporting/local/src/main/java/com/intuit/tank/reporting/local/ResultsStorage.java deleted file mode 100644 index 78b2c45d7..000000000 --- a/reporting/local/src/main/java/com/intuit/tank/reporting/local/ResultsStorage.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.intuit.tank.reporting.local; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import jakarta.annotation.Nonnull; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import com.intuit.tank.reporting.api.TPSInfo; -import com.intuit.tank.reporting.api.TPSInfoContainer; -import com.intuit.tank.results.TankResult; - -public final class ResultsStorage { - - private static final Logger LOG = LogManager.getLogger(ResultsStorage.class); - private static ResultsStorage instance = new ResultsStorage(); - - private Map>> timingResultMap = new ConcurrentHashMap>>(); - private Map>> tpsMap = new ConcurrentHashMap>>(); - - private ResultsStorage() { - // private constructor to implement singleton pattern - } - - public static final ResultsStorage instance() { - return instance; - } - - /** - * - * @param jobId - * @param results - */ - public void storeTimingResults(@Nonnull String jobId, @Nonnull String instanceId, List results) { - if (results != null && !results.isEmpty()) { - Map> map = timingResultMap.get(jobId); - if (map == null) { - map = new ConcurrentHashMap>(); - timingResultMap.put(jobId, map); - } - List list = map.computeIfAbsent(instanceId, k -> new ArrayList()); - list.addAll(results); - } - } - - /** - * - * @param jobId - * @param results - */ - public void storeTpsResults(@Nonnull String jobId, @Nonnull String instanceId, TPSInfoContainer container) { - if (container != null) { - LOG.info("Storing results for job: " + jobId + " instance: " + instanceId); - Map> map = tpsMap.get(jobId); - if (map == null) { - map = new ConcurrentHashMap>(); - tpsMap.put(jobId, map); - LOG.info("Creating Map for job: " + jobId); - } - List list = map.get(instanceId); - if (list == null) { - list = new ArrayList(); - map.put(instanceId, list); - LOG.info("Creating List for instance: " + instanceId); - } - list.add(container); - } - } - - /** - * - * @param jobId - * @return - */ - public List getAllTimingResults(String jobId) { - List ret = new ArrayList(); - Map> map = timingResultMap.get(jobId); - if (map != null) { - for (List r : map.values()) { - ret.addAll(r); - } - } - - return ret; - } - - public void deleteForJob(String jobId) { - timingResultMap.remove(jobId); - } - - public Map> getTpsMapForJob(Date minDate, String... jobId) { - List containers = new ArrayList(); - for (String id : jobId) { - Map> map = tpsMap.get(id); - if (map != null) { - for (List list : map.values()) { - containers.addAll(list); - } - } - } - LOG.info("Have " + containers.size() + " containers for jobs " + Arrays.toString(jobId)); - return getTpsMapForJob(minDate, containers); - } - - public Map> getTpsMapForInstance(Date minDate, String jobId, String instanceId) { - List containers = new ArrayList(); - Map> map = tpsMap.get(jobId); - if (map != null) { - List list = map.get(instanceId); - if (list != null) { - containers.addAll(list); - } - } - LOG.info("Have " + containers.size() + " containers for job " + jobId + " and instance " + instanceId); - return getTpsMapForJob(minDate, containers); - } - - private Map> getTpsMapForJob(Date minDate, List conatiners) { - Map> ret = new HashMap>(); - for (TPSInfoContainer container : conatiners) { - for (TPSInfo info : container.getTpsInfos()) { - if (minDate != null && info.getTimestamp().getTime() >= minDate.getTime()) { - Map map = ret.computeIfAbsent(info.getTimestamp(), k -> new HashMap()); - TPSInfo existing = map.get(info.getKey()); - if (existing != null) { - info = existing.add(info); - } - map.put(info.getKey(), info); - } - } - } - return ret; - } - -} diff --git a/reporting/local/src/main/java/com/intuit/tank/reporting/rest/RestResultsReader.java b/reporting/local/src/main/java/com/intuit/tank/reporting/rest/RestResultsReader.java deleted file mode 100644 index 2e28c938a..000000000 --- a/reporting/local/src/main/java/com/intuit/tank/reporting/rest/RestResultsReader.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Copyright 2011 Intuit Inc. All Rights Reserved - */ -package com.intuit.tank.reporting.rest; - -import java.util.Date; -import java.util.List; -import java.util.Map; - -import org.apache.commons.configuration.HierarchicalConfiguration; - -import com.intuit.tank.reporting.api.PagedTimingResults; -import com.intuit.tank.reporting.api.ResultsReader; -import com.intuit.tank.reporting.api.TPSInfo; -import com.intuit.tank.reporting.local.ResultsStorage; -import com.intuit.tank.results.TankResult; - -/** - * RestResultsReader - * - * @author dangleton - * - */ -public class RestResultsReader implements ResultsReader { - - @Override - public List getAllTimingResults(String jobId) { - return ResultsStorage.instance().getAllTimingResults(jobId); - } - - @Override - public PagedTimingResults getPagedTimingResults(String jobId, Object nextToken) { - return new PagedTimingResults(null, ResultsStorage.instance().getAllTimingResults(jobId)); - } - - @Override - public boolean hasTimingData(String jobId) { - return !ResultsStorage.instance().getAllTimingResults(jobId).isEmpty(); - } - - @Override - public void deleteTimingForJob(String jobId, boolean asynch) { - ResultsStorage.instance().deleteForJob(jobId); - } - - @Override - public Map> getTpsMapForJob(Date minDate, String... jobId) { - return ResultsStorage.instance().getTpsMapForJob(minDate, jobId); - } - - @Override - public Map> getTpsMapForInstance(Date minDate, String jobId, String instanceId) { - return ResultsStorage.instance().getTpsMapForInstance(minDate, jobId, instanceId); - } - - @Override - public void config(HierarchicalConfiguration config) { - // nothing to do - } - -} diff --git a/reporting/local/src/main/resources/META-INF/beans.xml b/reporting/local/src/main/resources/META-INF/beans.xml deleted file mode 100644 index fd5a160e6..000000000 --- a/reporting/local/src/main/resources/META-INF/beans.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - diff --git a/reporting/pom.xml b/reporting/pom.xml deleted file mode 100644 index 810e7fe4a..000000000 --- a/reporting/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - 4.0.0 - - - com.intuit.tank - tank-parent - 4.1.1-SNAPSHOT - - - reporting-parent - - pom - Reporting Parent - - - db - api - local - - - - - - jakarta.enterprise - jakarta.enterprise.cdi-api - - - - commons-io - commons-io - - - - - diff --git a/reporting/rest/pom.xml b/reporting/rest/pom.xml deleted file mode 100644 index 67d7f70fc..000000000 --- a/reporting/rest/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - 4.0.0 - - - com.intuit.tank - reporting-parent - 4.1.1-SNAPSHOT - - - reporting-rest - - jar - Reporting Rest support - - - - - ${project.groupId} - api - ${project.version} - - - - ${project.groupId} - reporting-api - ${project.version} - - - - - - diff --git a/reporting/rest/src/main/java/com/intuit/tank/reporting/rest/RestResultsReporter.java b/reporting/rest/src/main/java/com/intuit/tank/reporting/rest/RestResultsReporter.java deleted file mode 100644 index 9862c7374..000000000 --- a/reporting/rest/src/main/java/com/intuit/tank/reporting/rest/RestResultsReporter.java +++ /dev/null @@ -1,101 +0,0 @@ -/** - * Copyright 2011 Intuit Inc. All Rights Reserved - */ -package com.intuit.tank.reporting.rest; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.Executors; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; - -import org.apache.commons.configuration.HierarchicalConfiguration; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import com.intuit.tank.client.v1.report.ReportServiceClientV1; -import com.intuit.tank.reporting.api.ResultsReporter; -import com.intuit.tank.reporting.api.TPSInfoContainer; -import com.intuit.tank.results.TankResult; -import com.intuit.tank.vm.settings.TankConfig; - -/** - * DatabaseResultsReporter - * - * @author dangleton - * - */ -public class RestResultsReporter implements ResultsReporter { - - private static final Logger LOG = LogManager.getLogger(RestResultsReporter.class); - - private static final ThreadPoolExecutor EXECUTOR = new ThreadPoolExecutor(10, 50, 60, TimeUnit.SECONDS, - new ArrayBlockingQueue(50), Executors.defaultThreadFactory(), - new ThreadPoolExecutor.DiscardOldestPolicy()); - - private ReportServiceClientV1 client; - - /** - * {@inheritDoc} - */ - @Override - public void sendTpsResults(final String jobId, final String instanceId, final TPSInfoContainer container, - boolean async) { - Runnable task = () -> { - try { - getClient().postTpsResults(jobId, instanceId, container); - } catch (Exception t) { - LOG.error("Error adding results: " + t.getMessage(), t); - throw new RuntimeException(t); - } - }; - if (async) { - EXECUTOR.execute(task); - } else { - task.run(); - } - } - - /** - * {@inheritDoc} - */ - @Override - public void sendTimingResults(final String jobId, final String instanceId, List results, boolean asynch) { - if (results != null && !results.isEmpty()) { - final List list = new ArrayList(results); - Runnable task = () -> { - try { - getClient().postTimingResults(jobId, instanceId, list); - } catch (Exception t) { - LOG.error("Error adding results: " + t.getMessage(), t); - throw new RuntimeException(t); - } - }; - if (asynch) { - EXECUTOR.execute(task); - } else { - task.run(); - } - } - } - - @Override - public void config(HierarchicalConfiguration config) { - try { - } catch (Exception e) { - LOG.error("Config not correct. Using default options."); - } - } - - private ReportServiceClientV1 getClient() { - if (client == null) { - TankConfig config = new TankConfig(); - config.getControllerBase(); - client = new ReportServiceClientV1(config.getControllerBase()); - } - return client; - - } - -} diff --git a/reporting/rest/src/main/resources/META-INF/beans.xml b/reporting/rest/src/main/resources/META-INF/beans.xml deleted file mode 100644 index fd5a160e6..000000000 --- a/reporting/rest/src/main/resources/META-INF/beans.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - diff --git a/web/web_support/src/main/java/com/intuit/tank/project/JobTreeTableBean.java b/web/web_support/src/main/java/com/intuit/tank/project/JobTreeTableBean.java index 8dcc9242e..934b1ebcc 100644 --- a/web/web_support/src/main/java/com/intuit/tank/project/JobTreeTableBean.java +++ b/web/web_support/src/main/java/com/intuit/tank/project/JobTreeTableBean.java @@ -54,9 +54,9 @@ import com.intuit.tank.job.VMNodeBean; import com.intuit.tank.prefs.TablePreferences; import com.intuit.tank.prefs.TableViewState; -import com.intuit.tank.reporting.api.ResultsReader; -import com.intuit.tank.reporting.api.TPSInfo; -import com.intuit.tank.reporting.factory.ReportingFactory; +import com.intuit.tank.reporting.ReportingFactory; +import com.intuit.tank.reporting.ResultsReader; +import com.intuit.tank.reporting.models.TPSInfo; import com.intuit.tank.util.ExceptionHandler; import org.primefaces.model.charts.ChartData; import org.primefaces.model.charts.axes.cartesian.CartesianScales; diff --git a/web/web_ui/src/main/webapp/META-INF/context.xml b/web/web_ui/src/main/webapp/META-INF/context.xml index 6a61946db..5c729aea5 100644 --- a/web/web_ui/src/main/webapp/META-INF/context.xml +++ b/web/web_ui/src/main/webapp/META-INF/context.xml @@ -5,5 +5,18 @@ auth="Container" type="jakarta.enterprise.inject.spi.BeanManager" factory="org.jboss.weld.resources.ManagerObjectFactory" /> + From 07001984e3fbc96fb5da3cc20f087c62afc547f4 Mon Sep 17 00:00:00 2001 From: Suman Nakshatri Date: Fri, 23 May 2025 11:53:02 -0400 Subject: [PATCH 2/4] SRE-35204: moved reporting test files --- .../reporting/TankResultBuilderBaseTest.java | 176 ++++++ .../tank/reporting/TankResultBuilderTest.java | 83 +++ .../module/TPSInfoContainerTest.java | 310 +++++++++++ .../tank/reporting/module/TPSInfoTest.java | 285 ++++++++++ .../module/TankAgentStatusResponseTest.java | 120 ++++ .../tank/reporting/module/TankResultTest.java | 523 ++++++++++++++++++ 6 files changed, 1497 insertions(+) create mode 100644 api/src/test/java/com/intuit/tank/reporting/TankResultBuilderBaseTest.java create mode 100644 api/src/test/java/com/intuit/tank/reporting/TankResultBuilderTest.java create mode 100644 api/src/test/java/com/intuit/tank/reporting/module/TPSInfoContainerTest.java create mode 100644 api/src/test/java/com/intuit/tank/reporting/module/TPSInfoTest.java create mode 100644 api/src/test/java/com/intuit/tank/reporting/module/TankAgentStatusResponseTest.java create mode 100644 api/src/test/java/com/intuit/tank/reporting/module/TankResultTest.java diff --git a/api/src/test/java/com/intuit/tank/reporting/TankResultBuilderBaseTest.java b/api/src/test/java/com/intuit/tank/reporting/TankResultBuilderBaseTest.java new file mode 100644 index 000000000..a4d82b386 --- /dev/null +++ b/api/src/test/java/com/intuit/tank/reporting/TankResultBuilderBaseTest.java @@ -0,0 +1,176 @@ +package com.intuit.tank.reporting; + +/* + * #%L + * Reporting API + * %% + * Copyright (C) 2011 - 2015 Intuit Inc. + * %% + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * #L% + */ + +import org.junit.jupiter.api.*; + +import com.intuit.tank.reporting.models.TankResult; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * The class TankResultBuilderBaseTest contains tests for the class + * {@link TankResultBuilderBase}. + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ +public class TankResultBuilderBaseTest { + /** + * Run the TankResultBuilderBase(TankResult) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testTankResultBuilderBase_1() + throws Exception { + TankResult aInstance = new TankResult(); + + TankResultBuilderBase result = new TankResultBuilderBase(aInstance); + + assertNotNull(result); + } + + /** + * Run the TankResult getInstance() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testGetInstance_1() + throws Exception { + TankResultBuilderBase fixture = new TankResultBuilderBase(new TankResult()); + + TankResult result = fixture.getInstance(); + + assertNotNull(result); + assertEquals(false, result.isError()); + assertEquals(null, result.getJobId()); + assertEquals(0, result.getResponseTime()); + assertEquals(0, result.getResponseSize()); + assertEquals(null, result.getRequestName()); + assertEquals(0, result.getStatusCode()); + } + + /** + * Run the TankResultBuilderBase withError(boolean) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testWithError_1() + throws Exception { + TankResultBuilderBase fixture = new TankResultBuilderBase(new TankResult()); + boolean aValue = true; + + TankResultBuilderBase result = fixture.withError(aValue); + + assertNotNull(result); + } + + /** + * Run the TankResultBuilderBase withJobId(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testWithJobId_1() + throws Exception { + TankResultBuilderBase fixture = new TankResultBuilderBase(new TankResult()); + String aValue = ""; + + TankResultBuilderBase result = fixture.withJobId(aValue); + + assertNotNull(result); + } + + /** + * Run the TankResultBuilderBase withRequestName(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testWithRequestName_1() + throws Exception { + TankResultBuilderBase fixture = new TankResultBuilderBase(new TankResult()); + String aValue = ""; + + TankResultBuilderBase result = fixture.withRequestName(aValue); + + assertNotNull(result); + } + + /** + * Run the TankResultBuilderBase withResponseSize(int) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testWithResponseSize_1() + throws Exception { + TankResultBuilderBase fixture = new TankResultBuilderBase(new TankResult()); + int aValue = 1; + + TankResultBuilderBase result = fixture.withResponseSize(aValue); + + assertNotNull(result); + } + + /** + * Run the TankResultBuilderBase withResponseTime(int) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testWithResponseTime_1() + throws Exception { + TankResultBuilderBase fixture = new TankResultBuilderBase(new TankResult()); + int aValue = 1; + + TankResultBuilderBase result = fixture.withResponseTime(aValue); + + assertNotNull(result); + } + + /** + * Run the TankResultBuilderBase withStatusCode(int) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testWithStatusCode_1() + throws Exception { + TankResultBuilderBase fixture = new TankResultBuilderBase(new TankResult()); + int aValue = 1; + + TankResultBuilderBase result = fixture.withStatusCode(aValue); + + assertNotNull(result); + } +} \ No newline at end of file diff --git a/api/src/test/java/com/intuit/tank/reporting/TankResultBuilderTest.java b/api/src/test/java/com/intuit/tank/reporting/TankResultBuilderTest.java new file mode 100644 index 000000000..3f08dc48c --- /dev/null +++ b/api/src/test/java/com/intuit/tank/reporting/TankResultBuilderTest.java @@ -0,0 +1,83 @@ +package com.intuit.tank.reporting; + +/* + * #%L + * Reporting API + * %% + * Copyright (C) 2011 - 2015 Intuit Inc. + * %% + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * #L% + */ + +import org.junit.jupiter.api.*; + +import com.intuit.tank.reporting.models.TankResult; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * The class TankResultBuilderTest contains tests for the class + * {@link TankResultBuilder}. + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ +public class TankResultBuilderTest { + /** + * Run the TankResultBuilder() constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testTankResultBuilder_1() + throws Exception { + + TankResultBuilder result = new TankResultBuilder(); + + assertNotNull(result); + } + + /** + * Run the TankResult build() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testBuild_1() + throws Exception { + TankResultBuilder fixture = new TankResultBuilder(); + + TankResult result = fixture.build(); + + assertNotNull(result); + assertEquals(false, result.isError()); + assertEquals(null, result.getJobId()); + assertEquals(0, result.getResponseTime()); + assertEquals(0, result.getResponseSize()); + assertEquals(null, result.getRequestName()); + assertEquals(0, result.getStatusCode()); + } + + /** + * Run the TankResultBuilder TankResult() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testTankResult_1() + throws Exception { + + TankResultBuilder result = TankResultBuilder.tankResult(); + + assertNotNull(result); + } +} \ No newline at end of file diff --git a/api/src/test/java/com/intuit/tank/reporting/module/TPSInfoContainerTest.java b/api/src/test/java/com/intuit/tank/reporting/module/TPSInfoContainerTest.java new file mode 100644 index 000000000..47d009b48 --- /dev/null +++ b/api/src/test/java/com/intuit/tank/reporting/module/TPSInfoContainerTest.java @@ -0,0 +1,310 @@ +package com.intuit.tank.reporting.module; + +/* + * #%L + * Cloud Rest API + * %% + * Copyright (C) 2011 - 2015 Intuit Inc. + * %% + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * #L% + */ + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +import java.util.Date; +import java.util.LinkedList; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.intuit.tank.reporting.models.TPSInfo; +import com.intuit.tank.reporting.models.TPSInfoContainer; + +/** + * The class TPSInfoContainerTest contains tests for the class {@link TPSInfoContainer}. + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ +public class TPSInfoContainerTest { + /** + * Run the TPSInfoContainer() constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ + @Test + public void testTPSInfoContainer_1() + throws Exception { + + TPSInfoContainer result = new TPSInfoContainer(); + + assertNotNull(result); + assertEquals(0, result.getPeriod()); + assertEquals(null, result.getMaxTime()); + assertEquals(null, result.getMinTime()); + assertEquals(0, result.getTotalTps()); + } + + /** + * Run the TPSInfoContainer(Date,Date,int,List) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ + @Test + public void testTPSInfoContainer_2() + throws Exception { + Date minTime = new Date(); + Date maxTime = new Date(); + int period = 1; + List tpsInfos = new LinkedList(); + + TPSInfoContainer result = new TPSInfoContainer(minTime, maxTime, period, tpsInfos); + + assertNotNull(result); + assertEquals(1, result.getPeriod()); + assertEquals(0, result.getTotalTps()); + } + + /** + * Run the TPSInfoContainer(Date,Date,int,List) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ + @Test + public void testTPSInfoContainer_3() + throws Exception { + Date minTime = new Date(); + Date maxTime = new Date(); + int period = 1; + List tpsInfos = new LinkedList(); + + TPSInfoContainer result = new TPSInfoContainer(minTime, maxTime, period, tpsInfos); + + assertNotNull(result); + assertEquals(1, result.getPeriod()); + assertEquals(0, result.getTotalTps()); + } + + /** + * Run the TPSInfoContainer(Date,Date,int,List) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ + @Test + public void testTPSInfoContainer_4() + throws Exception { + Date minTime = new Date(); + Date maxTime = new Date(); + int period = 1; + List tpsInfos = new LinkedList(); + + TPSInfoContainer result = new TPSInfoContainer(minTime, maxTime, period, tpsInfos); + + assertNotNull(result); + assertEquals(1, result.getPeriod()); + assertEquals(0, result.getTotalTps()); + } + + /** + * Run the TPSInfoContainer(Date,Date,int,List) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ + @Test + public void testTPSInfoContainer_5() + throws Exception { + Date minTime = new Date(); + Date maxTime = new Date(); + int period = 1; + List tpsInfos = new LinkedList(); + + TPSInfoContainer result = new TPSInfoContainer(minTime, maxTime, period, tpsInfos); + + assertNotNull(result); + assertEquals(1, result.getPeriod()); + assertEquals(0, result.getTotalTps()); + } + + /** + * Run the TPSInfoContainer(Date,Date,int,List) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ + @Test + public void testTPSInfoContainer_6() + throws Exception { + Date minTime = new Date(); + Date maxTime = new Date(); + int period = 1; + List tpsInfos = new LinkedList(); + + TPSInfoContainer result = new TPSInfoContainer(minTime, maxTime, period, tpsInfos); + + assertNotNull(result); + assertEquals(1, result.getPeriod()); + assertEquals(0, result.getTotalTps()); + } + + /** + * Run the TPSInfoContainer(Date,Date,int,List) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ + @Test + public void testTPSInfoContainer_7() + throws Exception { + Date minTime = new Date(); + Date maxTime = new Date(); + int period = 1; + List tpsInfos = new LinkedList(); + + TPSInfoContainer result = new TPSInfoContainer(minTime, maxTime, period, tpsInfos); + + assertNotNull(result); + assertEquals(1, result.getPeriod()); + assertEquals(0, result.getTotalTps()); + } + + /** + * Run the TPSInfoContainer(Date,Date,int,List) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ + @Test + public void testTPSInfoContainer_8() + throws Exception { + Date minTime = new Date(); + Date maxTime = new Date(); + int period = 1; + List tpsInfos = null; + + TPSInfoContainer result = new TPSInfoContainer(minTime, maxTime, period, tpsInfos); + + assertNotNull(result); + assertEquals(1, result.getPeriod()); + assertEquals(null, result.getTpsInfos()); + assertEquals(0, result.getTotalTps()); + } + + /** + * Run the Date getMaxTime() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ + @Test + public void testGetMaxTime_1() + throws Exception { + TPSInfoContainer fixture = new TPSInfoContainer(new Date(), new Date(), 1, new LinkedList()); + + Date result = fixture.getMaxTime(); + + assertNotNull(result); + } + + /** + * Run the Date getMinTime() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ + @Test + public void testGetMinTime_1() + throws Exception { + TPSInfoContainer fixture = new TPSInfoContainer(new Date(), new Date(), 1, new LinkedList()); + + Date result = fixture.getMinTime(); + + assertNotNull(result); + } + + /** + * Run the int getPeriod() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ + @Test + public void testGetPeriod_1() + throws Exception { + TPSInfoContainer fixture = new TPSInfoContainer(new Date(), new Date(), 1, new LinkedList()); + + int result = fixture.getPeriod(); + + assertEquals(1, result); + } + + /** + * Run the int getTotalTps() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ + @Test + public void testGetTotalTps_1() + throws Exception { + TPSInfoContainer fixture = new TPSInfoContainer(new Date(), new Date(), 1, new LinkedList()); + + int result = fixture.getTotalTps(); + + assertEquals(0, result); + } + + /** + * Run the List getTpsInfos() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ + @Test + public void testGetTpsInfos_1() + throws Exception { + TPSInfoContainer fixture = new TPSInfoContainer(new Date(), new Date(), 1, new LinkedList()); + + List result = fixture.getTpsInfos(); + + assertNotNull(result); + assertEquals(0, result.size()); + } + + /** + * Run the String toString() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ + @Test + public void testToString_1() + throws Exception { + TPSInfoContainer fixture = new TPSInfoContainer(new Date(), new Date(), 1, new LinkedList()); + + String result = fixture.toString(); + + } +} \ No newline at end of file diff --git a/api/src/test/java/com/intuit/tank/reporting/module/TPSInfoTest.java b/api/src/test/java/com/intuit/tank/reporting/module/TPSInfoTest.java new file mode 100644 index 000000000..b2a1c5a71 --- /dev/null +++ b/api/src/test/java/com/intuit/tank/reporting/module/TPSInfoTest.java @@ -0,0 +1,285 @@ +package com.intuit.tank.reporting.module; + +/* + * #%L + * Cloud Rest API + * %% + * Copyright (C) 2011 - 2015 Intuit Inc. + * %% + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * #L% + */ +import java.util.Date; + +import org.junit.jupiter.api.*; + +import com.intuit.tank.reporting.models.TPSInfo; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * The class TPSInfoTest contains tests for the class {@link TPSInfo}. + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ +public class TPSInfoTest { + /** + * Run the TPSInfo() constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ + @Test + public void testTPSInfo_1() + throws Exception { + + TPSInfo result = new TPSInfo(); + + assertNotNull(result); + assertEquals(null, result.getTimestamp()); + assertEquals(null, result.getKey()); + assertEquals(0, result.getTPS()); + assertEquals(0, result.getPeriodInSeconds()); + assertEquals(0, result.getTransactions()); + } + + /** + * Run the TPSInfo(Date,String,int,int) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ + @Test + public void testTPSInfo_2() + throws Exception { + Date timestamp = new Date(); + String key = ""; + int transactions = 1; + int period = 1; + + TPSInfo result = new TPSInfo(timestamp, key, transactions, period); + + assertNotNull(result); + assertEquals("", result.getKey()); + assertEquals(1, result.getTPS()); + assertEquals(1, result.getPeriodInSeconds()); + assertEquals(1, result.getTransactions()); + } + + /** + * Run the TPSInfo add(TPSInfo) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ + @Test + public void testAdd_1() + throws Exception { + TPSInfo fixture = new TPSInfo(new Date(), "", 1, 1); + TPSInfo toAdd = new TPSInfo(new Date(), "", 1, 1); + + TPSInfo result = fixture.add(toAdd); + + assertNotNull(result); + assertEquals("", result.getKey()); + assertEquals(2, result.getTPS()); + assertEquals(1, result.getPeriodInSeconds()); + assertEquals(2, result.getTransactions()); + } + + /** + * Run the boolean equals(Object) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ + @Test + public void testEquals_1() + throws Exception { + TPSInfo fixture = new TPSInfo(new Date(), "", 1, 1); + Object obj = new Object(); + + boolean result = fixture.equals(obj); + + assertEquals(false, result); + } + + /** + * Run the boolean equals(Object) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ + @Test + public void testEquals_2() + throws Exception { + Date date = new Date(); + TPSInfo fixture = new TPSInfo(date, "", 1, 1); + Object obj = new TPSInfo(date, "", 1, 1); + + boolean result = fixture.equals(obj); + + assertEquals(true, result); + } + + /** + * Run the boolean equals(Object) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ + @Test + public void testEquals_3() + throws Exception { + Date date = new Date(); + TPSInfo fixture = new TPSInfo(date, "", 1, 1); + Object obj = new TPSInfo(date, "", 1, 1); + + boolean result = fixture.equals(obj); + + assertEquals(true, result); + } + + /** + * Run the String getKey() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ + @Test + public void testGetKey_1() + throws Exception { + TPSInfo fixture = new TPSInfo(new Date(), "", 1, 1); + + String result = fixture.getKey(); + + assertEquals("", result); + } + + /** + * Run the int getPeriodInSeconds() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ + @Test + public void testGetPeriodInSeconds_1() + throws Exception { + TPSInfo fixture = new TPSInfo(new Date(), "", 1, 1); + + int result = fixture.getPeriodInSeconds(); + + assertEquals(1, result); + } + + /** + * Run the int getTPS() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ + @Test + public void testGetTPS_1() + throws Exception { + TPSInfo fixture = new TPSInfo(new Date(), "", 1, 1); + + int result = fixture.getTPS(); + + assertEquals(1, result); + } + + /** + * Run the int getTPS() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ + @Test + public void testGetTPS_2() + throws Exception { + TPSInfo fixture = new TPSInfo(new Date(), "", 1, 0); + + int result = fixture.getTPS(); + + assertEquals(0, result); + } + + /** + * Run the Date getTimestamp() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ + @Test + public void testGetTimestamp_1() + throws Exception { + TPSInfo fixture = new TPSInfo(new Date(), "", 1, 1); + + Date result = fixture.getTimestamp(); + + assertNotNull(result); + } + + /** + * Run the int getTransactions() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ + @Test + public void testGetTransactions_1() + throws Exception { + TPSInfo fixture = new TPSInfo(new Date(), "", 1, 1); + + int result = fixture.getTransactions(); + + assertEquals(1, result); + } + + /** + * Run the int hashCode() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ + @Test + public void testHashCode_1() + throws Exception { + TPSInfo fixture = new TPSInfo(new Date(), "", 1, 1); + + int result = fixture.hashCode(); + + } + + /** + * Run the String toString() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 12/15/14 2:57 PM + */ + @Test + public void testToString_1() + throws Exception { + TPSInfo fixture = new TPSInfo(new Date(), "", 1, 1); + + String result = fixture.toString(); + + } +} \ No newline at end of file diff --git a/api/src/test/java/com/intuit/tank/reporting/module/TankAgentStatusResponseTest.java b/api/src/test/java/com/intuit/tank/reporting/module/TankAgentStatusResponseTest.java new file mode 100644 index 000000000..f6da1d191 --- /dev/null +++ b/api/src/test/java/com/intuit/tank/reporting/module/TankAgentStatusResponseTest.java @@ -0,0 +1,120 @@ +package com.intuit.tank.reporting.module; + +/* + * #%L + * Reporting API + * %% + * Copyright (C) 2011 - 2015 Intuit Inc. + * %% + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * #L% + */ + +import org.junit.jupiter.api.*; + +import com.intuit.tank.reporting.models.TankAgentStatusResponse; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * The class TankAgentStatusResponseTest contains tests for the class + * {@link TankAgentStatusResponse}. + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ +public class TankAgentStatusResponseTest { + /** + * Run the TankAgentStatusResponse(long,int,int,int) constructor test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testTankAgentStatusResponse_1() + throws Exception { + long time = 1L; + int num = 1; + int max = 1; + int ramp = 1; + + TankAgentStatusResponse result = new TankAgentStatusResponse(time, num, max, ramp); + + assertNotNull(result); + assertEquals(1, result.getMaxVirtualUsers()); + assertEquals(1L, result.getRunTime()); + assertEquals(1, result.getCurrentNumberUsers()); + assertEquals(1, result.getRampTimeLeft()); + } + + /** + * Run the int getCurrentNumberUsers() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testGetCurrentNumberUsers_1() + throws Exception { + TankAgentStatusResponse fixture = new TankAgentStatusResponse(1L, 1, 1, 1); + + int result = fixture.getCurrentNumberUsers(); + + assertEquals(1, result); + } + + /** + * Run the int getMaxVirtualUsers() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testGetMaxVirtualUsers_1() + throws Exception { + TankAgentStatusResponse fixture = new TankAgentStatusResponse(1L, 1, 1, 1); + + int result = fixture.getMaxVirtualUsers(); + + assertEquals(1, result); + } + + /** + * Run the int getRampTimeLeft() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testGetRampTimeLeft_1() + throws Exception { + TankAgentStatusResponse fixture = new TankAgentStatusResponse(1L, 1, 1, 1); + + int result = fixture.getRampTimeLeft(); + + assertEquals(1, result); + } + + /** + * Run the long getRunTime() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testGetRunTime_1() + throws Exception { + TankAgentStatusResponse fixture = new TankAgentStatusResponse(1L, 1, 1, 1); + + long result = fixture.getRunTime(); + + assertEquals(1L, result); + } +} \ No newline at end of file diff --git a/api/src/test/java/com/intuit/tank/reporting/module/TankResultTest.java b/api/src/test/java/com/intuit/tank/reporting/module/TankResultTest.java new file mode 100644 index 000000000..0b876eccd --- /dev/null +++ b/api/src/test/java/com/intuit/tank/reporting/module/TankResultTest.java @@ -0,0 +1,523 @@ +package com.intuit.tank.reporting.module; + +/* + * #%L + * Reporting API + * %% + * Copyright (C) 2011 - 2015 Intuit Inc. + * %% + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * #L% + */ +import java.util.Date; + +import org.junit.jupiter.api.*; + +import com.intuit.tank.reporting.models.TankResult; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * The class TankResultTest contains tests for the class {@link TankResult}. + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ +public class TankResultTest { + /** + * Run the TankResult() constructor test. + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testTankResult_1() + throws Exception { + TankResult result = new TankResult(); + assertNotNull(result); + } + + /** + * Run the void add(TankResult) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testAdd_1() + throws Exception { + TankResult fixture = new TankResult(); + fixture.setError(true); + fixture.setResponseSize(1); + fixture.setResponseTime(1); + fixture.setJobId(""); + fixture.setTimeStamp(new Date()); + fixture.setStatusCode(0); + fixture.setRequestName(""); + TankResult result = new TankResult(); + result.setError(true); + + fixture.add(result); + + } + + /** + * Run the void add(TankResult) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testAdd_2() + throws Exception { + TankResult fixture = new TankResult(); + fixture.setError(true); + fixture.setResponseSize(1); + fixture.setResponseTime(1); + fixture.setJobId(""); + fixture.setTimeStamp(new Date()); + fixture.setStatusCode(1); + fixture.setRequestName(""); + TankResult result = new TankResult(); + result.setError(true); + + fixture.add(result); + + } + + /** + * Run the void add(TankResult) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testAdd_3() + throws Exception { + TankResult fixture = new TankResult(); + fixture.setError(false); + fixture.setResponseSize(1); + fixture.setResponseTime(1); + fixture.setJobId(""); + fixture.setTimeStamp(new Date()); + fixture.setStatusCode(0); + fixture.setRequestName(""); + TankResult result = new TankResult(); + result.setError(false); + + fixture.add(result); + + } + + /** + * Run the void add(TankResult) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testAdd_4() + throws Exception { + TankResult fixture = new TankResult(); + fixture.setError(false); + fixture.setResponseSize(1); + fixture.setResponseTime(1); + fixture.setJobId(""); + fixture.setTimeStamp(new Date()); + fixture.setStatusCode(1); + fixture.setRequestName(""); + TankResult result = new TankResult(); + result.setError(false); + + fixture.add(result); + + } + + /** + * Run the String getJobId() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testGetJobId_1() + throws Exception { + TankResult fixture = new TankResult(); + fixture.setError(true); + fixture.setResponseSize(1); + fixture.setResponseTime(1); + fixture.setJobId(""); + fixture.setTimeStamp(new Date()); + fixture.setStatusCode(1); + fixture.setRequestName(""); + + String result = fixture.getJobId(); + + assertEquals("", result); + } + + /** + * Run the String getRequestName() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testGetRequestName_1() + throws Exception { + TankResult fixture = new TankResult(); + fixture.setError(true); + fixture.setResponseSize(1); + fixture.setResponseTime(1); + fixture.setJobId(""); + fixture.setTimeStamp(new Date()); + fixture.setStatusCode(1); + fixture.setRequestName(""); + + String result = fixture.getRequestName(); + + assertEquals("", result); + } + + /** + * Run the int getResponseSize() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testGetResponseSize_1() + throws Exception { + TankResult fixture = new TankResult(); + fixture.setError(true); + fixture.setResponseSize(1); + fixture.setResponseTime(1); + fixture.setJobId(""); + fixture.setTimeStamp(new Date()); + fixture.setStatusCode(1); + fixture.setRequestName(""); + + int result = fixture.getResponseSize(); + + assertEquals(1, result); + } + + /** + * Run the int getResponseTime() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testGetResponseTime_1() + throws Exception { + TankResult fixture = new TankResult(); + fixture.setError(true); + fixture.setResponseSize(1); + fixture.setResponseTime(1); + fixture.setJobId(""); + fixture.setTimeStamp(new Date()); + fixture.setStatusCode(1); + fixture.setRequestName(""); + + int result = fixture.getResponseTime(); + + assertEquals(1, result); + } + + /** + * Run the int getStatusCode() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testGetStatusCode_1() + throws Exception { + TankResult fixture = new TankResult(); + fixture.setError(true); + fixture.setResponseSize(1); + fixture.setResponseTime(1); + fixture.setJobId(""); + fixture.setTimeStamp(new Date()); + fixture.setStatusCode(1); + fixture.setRequestName(""); + + int result = fixture.getStatusCode(); + + assertEquals(1, result); + } + + /** + * Run the Date getTimeStamp() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testGetTimeStamp_1() + throws Exception { + TankResult fixture = new TankResult(); + fixture.setError(true); + fixture.setResponseSize(1); + fixture.setResponseTime(1); + fixture.setJobId(""); + fixture.setTimeStamp(new Date()); + fixture.setStatusCode(1); + fixture.setRequestName(""); + + Date result = fixture.getTimeStamp(); + + assertNotNull(result); + } + + /** + * Run the boolean isError() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testIsError_1() + throws Exception { + TankResult fixture = new TankResult(); + fixture.setError(true); + fixture.setResponseSize(1); + fixture.setResponseTime(1); + fixture.setJobId(""); + fixture.setTimeStamp(new Date()); + fixture.setStatusCode(1); + fixture.setRequestName(""); + + boolean result = fixture.isError(); + + assertEquals(true, result); + } + + /** + * Run the boolean isError() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testIsError_2() + throws Exception { + TankResult fixture = new TankResult(); + fixture.setError(false); + fixture.setResponseSize(1); + fixture.setResponseTime(1); + fixture.setJobId(""); + fixture.setTimeStamp(new Date()); + fixture.setStatusCode(1); + fixture.setRequestName(""); + + boolean result = fixture.isError(); + + assertEquals(false, result); + } + + /** + * Run the void setError(boolean) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testSetError_1() + throws Exception { + TankResult fixture = new TankResult(); + fixture.setError(true); + fixture.setResponseSize(1); + fixture.setResponseTime(1); + fixture.setJobId(""); + fixture.setTimeStamp(new Date()); + fixture.setStatusCode(1); + fixture.setRequestName(""); + boolean error = true; + + fixture.setError(error); + + } + + /** + * Run the void setJobId(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testSetJobId_1() + throws Exception { + TankResult fixture = new TankResult(); + fixture.setError(true); + fixture.setResponseSize(1); + fixture.setResponseTime(1); + fixture.setJobId(""); + fixture.setTimeStamp(new Date()); + fixture.setStatusCode(1); + fixture.setRequestName(""); + String jobId = ""; + + fixture.setJobId(jobId); + + } + + /** + * Run the void setRequestName(String) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testSetRequestName_1() + throws Exception { + TankResult fixture = new TankResult(); + fixture.setError(true); + fixture.setResponseSize(1); + fixture.setResponseTime(1); + fixture.setJobId(""); + fixture.setTimeStamp(new Date()); + fixture.setStatusCode(1); + fixture.setRequestName(""); + String requestName = ""; + + fixture.setRequestName(requestName); + + } + + /** + * Run the void setResponseSize(int) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testSetResponseSize_1() + throws Exception { + TankResult fixture = new TankResult(); + fixture.setError(true); + fixture.setResponseSize(1); + fixture.setResponseTime(1); + fixture.setJobId(""); + fixture.setTimeStamp(new Date()); + fixture.setStatusCode(1); + fixture.setRequestName(""); + int responseSize = 1; + + fixture.setResponseSize(responseSize); + + } + + /** + * Run the void setResponseTime(int) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testSetResponseTime_1() + throws Exception { + TankResult fixture = new TankResult(); + fixture.setError(true); + fixture.setResponseSize(1); + fixture.setResponseTime(1); + fixture.setJobId(""); + fixture.setTimeStamp(new Date()); + fixture.setStatusCode(1); + fixture.setRequestName(""); + int connectionTime = 1; + + fixture.setResponseTime(connectionTime); + + } + + /** + * Run the void setStatusCode(int) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testSetStatusCode_1() + throws Exception { + TankResult fixture = new TankResult(); + fixture.setError(true); + fixture.setResponseSize(1); + fixture.setResponseTime(1); + fixture.setJobId(""); + fixture.setTimeStamp(new Date()); + fixture.setStatusCode(1); + fixture.setRequestName(""); + int statusCode = 1; + + fixture.setStatusCode(statusCode); + + } + + /** + * Run the void setTimeStamp(Date) method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testSetTimeStamp_1() + throws Exception { + TankResult fixture = new TankResult(); + fixture.setError(true); + fixture.setResponseSize(1); + fixture.setResponseTime(1); + fixture.setJobId(""); + fixture.setTimeStamp(new Date()); + fixture.setStatusCode(1); + fixture.setRequestName(""); + Date timeStamp = new Date(); + + fixture.setTimeStamp(timeStamp); + + } + + /** + * Run the String toString() method test. + * + * @throws Exception + * + * @generatedBy CodePro at 9/10/14 10:31 AM + */ + @Test + public void testToString_1() + throws Exception { + TankResult fixture = new TankResult(); + fixture.setError(true); + fixture.setResponseSize(1); + fixture.setResponseTime(1); + fixture.setJobId(""); + fixture.setTimeStamp(new Date()); + fixture.setStatusCode(1); + fixture.setRequestName(""); + + String result = fixture.toString(); + + } +} \ No newline at end of file From 97ee7562bd6469c4adb64757179d766dd5b38a01 Mon Sep 17 00:00:00 2001 From: Suman Nakshatri Date: Fri, 23 May 2025 11:54:42 -0400 Subject: [PATCH 3/4] SRE-35204: clean up --- web/web_ui/src/main/webapp/META-INF/context.xml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/web/web_ui/src/main/webapp/META-INF/context.xml b/web/web_ui/src/main/webapp/META-INF/context.xml index 5c729aea5..6a61946db 100644 --- a/web/web_ui/src/main/webapp/META-INF/context.xml +++ b/web/web_ui/src/main/webapp/META-INF/context.xml @@ -5,18 +5,5 @@ auth="Container" type="jakarta.enterprise.inject.spi.BeanManager" factory="org.jboss.weld.resources.ManagerObjectFactory" /> - From 3de095e934da4111a917d3dc3147a281dc74f57e Mon Sep 17 00:00:00 2001 From: Suman Nakshatri Date: Fri, 23 May 2025 12:01:51 -0400 Subject: [PATCH 4/4] SRE-35204: clean up createtablemessage --- .../reporting/models/CreateTableMessage.java | 30 ------------------- 1 file changed, 30 deletions(-) delete mode 100644 api/src/main/java/com/intuit/tank/reporting/models/CreateTableMessage.java diff --git a/api/src/main/java/com/intuit/tank/reporting/models/CreateTableMessage.java b/api/src/main/java/com/intuit/tank/reporting/models/CreateTableMessage.java deleted file mode 100644 index e071977c2..000000000 --- a/api/src/main/java/com/intuit/tank/reporting/models/CreateTableMessage.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.intuit.tank.reporting.models; - -/* - * #%L - * Reporting API - * %% - * Copyright (C) 2011 - 2015 Intuit Inc. - * %% - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * #L% - */ - -import java.io.Serializable; - -public class CreateTableMessage implements Serializable { - - private static final long serialVersionUID = 2597506740196523603L; - private String tableName; - - public String getTableName() { - return tableName; - } - - public void setTableName(String tableName) { - this.tableName = tableName; - } -}