Skip to content

Commit 0cad65f

Browse files
kevin-mcgoldrickUjoavaishakhvhvaishakhhegdefelixgao
authored
Release 3.0.0
* More test cases & code coverage for issue Co-authored-by: vhegde1 <[email protected]> * Update/Compress existing serializedScriptStep Blob * added test coverage for com.intuit.tank.dao package to increase from 46% to 55% Co-authored-by: Sreekakula, Manikanta <[email protected]> * Improving test coverage in data-model module Co-authored-by: djagaluru <[email protected]> * Improving test coverage for data-model project module Co-authored-by: djagaluru <[email protected]> * increase test coverage for api module Co-authored-by: atayal <[email protected]> * JDK11 support Co-authored-by: Niti <[email protected]> * AWS SDK V2 Co-authored-by: dratler <[email protected]> Co-authored-by: Juan Parra <[email protected]> Co-authored-by: vaishakhvh <[email protected]> Co-authored-by: vhegde1 <[email protected]> Co-authored-by: felixgao <[email protected]> Co-authored-by: Manikanta <[email protected]> Co-authored-by: Sreekakula, Manikanta <[email protected]> Co-authored-by: darshan-sj <[email protected]> Co-authored-by: djagaluru <[email protected]> Co-authored-by: interactwithankush <[email protected]> Co-authored-by: atayal <[email protected]> Co-authored-by: Niti <[email protected]>
1 parent d1c505b commit 0cad65f

File tree

208 files changed

+4238
-1822
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

208 files changed

+4238
-1822
lines changed

.travis.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
language: java
22
jdk:
3-
- openjdk8
3+
- openjdk11
4+
5+
env:
6+
- SKIP_METHODTIMER_TEST=true
47

58
script: mvn clean install -P default,coverage

agent/agent_common/pom.xml

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.intuit.tank</groupId>
77
<artifactId>agent-parent</artifactId>
8-
<version>2.3.4</version>
8+
<version>3.0.0</version>
99
</parent>
1010

1111
<artifactId>agent-common</artifactId>
@@ -36,6 +36,11 @@
3636
<groupId>org.jdom</groupId>
3737
<artifactId>jdom</artifactId>
3838
</dependency>
39+
40+
<dependency>
41+
<groupId>jakarta.xml.ws</groupId>
42+
<artifactId>jakarta.xml.ws-api</artifactId>
43+
</dependency>
3944
</dependencies>
4045

4146
</project>

agent/agent_common/src/main/java/com/intuit/tank/http/xml/GenericXMLHandler.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.jdom2.JDOMException;
3434
import org.jdom2.Namespace;
3535
import org.jdom2.input.SAXBuilder;
36+
import org.jdom2.input.sax.XMLReaders;
3637
import org.jdom2.output.XMLOutputter;
3738
import org.jdom2.xpath.XPath;
3839
import org.xml.sax.InputSource;
@@ -72,7 +73,7 @@ public GenericXMLHandler(File xmlFile) {
7273
this.xmlFile = xmlFile;
7374
this.xmlDocument = new org.jdom2.Document();
7475
SAXBuilder builder = new SAXBuilder();
75-
builder.setValidation(false);
76+
builder.setXMLReaderFactory(XMLReaders.NONVALIDATING);
7677
this.xmlDocument = builder.build(this.xmlFile);
7778
this.namespaces = new HashMap<String, String>();
7879
} catch (Exception ex) {
@@ -94,7 +95,7 @@ public GenericXMLHandler(String xmlFile) {
9495
this.xmlFile = null;
9596
this.xmlDocument = new org.jdom2.Document();
9697
SAXBuilder builder = new SAXBuilder();
97-
builder.setValidation(false);
98+
builder.setXMLReaderFactory(XMLReaders.NONVALIDATING);
9899
// LOG.debug("XML string to load: "+xmlFile);
99100
xmlFile = xmlFile.substring(xmlFile.indexOf("<"));
100101
this.xmlDocument = builder.build(new StringReader(xmlFile));
@@ -156,6 +157,7 @@ private Element SetElementText(String xPathExpression, int currentNode) throws J
156157
if (xPathExists(currentPath)) {
157158
if (currentPath.equals(xPathExpression)) {
158159
return (org.jdom2.Element) XPath.selectSingleNode(this.xmlDocument, xPathExpression);
160+
159161
}
160162
else {
161163
return SetElementText(xPathExpression, currentNode + 1);

agent/agent_common/src/test/java/com/intuit/tank/http/soap/SOAPRequestTest.java

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import static org.junit.jupiter.api.Assertions.assertNotNull;
44

5+
import org.junit.jupiter.api.Disabled;
56
import org.junit.jupiter.api.Test;
67

78
/**
@@ -129,6 +130,7 @@ public void testGetKey_1()
129130
* @generatedBy CodePro at 12/16/14 4:29 PM
130131
*/
131132
@Test
133+
@Disabled
132134
public void testSetKey_1()
133135
throws Exception {
134136
SOAPRequest fixture = new SOAPRequest(null, null);

agent/agent_standalone/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.intuit.tank</groupId>
77
<artifactId>agent-parent</artifactId>
8-
<version>2.3.4</version>
8+
<version>3.0.0</version>
99
</parent>
1010

1111
<artifactId>agent-standalone</artifactId>

agent/agent_standalone_pkg/pom.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.intuit.tank</groupId>
77
<artifactId>agent-parent</artifactId>
8-
<version>2.3.4</version>
8+
<version>3.0.0</version>
99
</parent>
1010

1111
<artifactId>agent-standalone-pkg</artifactId>
@@ -40,6 +40,7 @@
4040
<finalName>agent-standalone</finalName>
4141
<descriptors>
4242
<descriptor>src/main/assembly/assembly.xml</descriptor>
43+
<descriptor>src/main/assembly/zip-assembly.xml</descriptor>
4344
</descriptors>
4445
<archive>
4546
<manifest>

agent/agent_startup/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.intuit.tank</groupId>
77
<artifactId>agent-parent</artifactId>
8-
<version>2.3.4</version>
8+
<version>3.0.0</version>
99
</parent>
1010

1111
<artifactId>agent-startup</artifactId>

agent/agent_startup/src/main/java/com/intuit/tank/agent/AgentStartup.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@
2424
import java.util.zip.ZipException;
2525
import java.util.zip.ZipInputStream;
2626

27-
import com.amazonaws.util.StringUtils;
2827
import org.apache.commons.io.FileUtils;
2928
import org.apache.commons.io.IOUtils;
3029
import org.apache.logging.log4j.LogManager;
3130
import org.apache.logging.log4j.Logger;
3231

3332
import com.intuit.tank.harness.AmazonUtil;
3433
import com.intuit.tank.vm.common.TankConstants;
34+
import software.amazon.awssdk.utils.StringUtils;
3535

3636
public class AgentStartup implements Runnable {
3737
private static Logger logger = LogManager.getLogger(AgentStartup.class);
@@ -110,7 +110,7 @@ public static void main(String[] args) {
110110
controllerBaseUrl = values[1];
111111
}
112112
}
113-
if (StringUtils.isNullOrEmpty(controllerBaseUrl)) {
113+
if (StringUtils.isEmpty(controllerBaseUrl)) {
114114
controllerBaseUrl = AmazonUtil.getControllerBaseUrl();
115115
}
116116
AgentStartup agentStartup = new AgentStartup(controllerBaseUrl);

agent/agent_startup_pkg/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.intuit.tank</groupId>
77
<artifactId>agent-parent</artifactId>
8-
<version>2.3.4</version>
8+
<version>3.0.0</version>
99
</parent>
1010

1111
<artifactId>agent-startup-pkg</artifactId>

agent/apiharness/pom.xml

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.intuit.tank</groupId>
77
<artifactId>agent-parent</artifactId>
8-
<version>2.3.4</version>
8+
<version>3.0.0</version>
99
</parent>
1010

1111
<artifactId>agent</artifactId>
@@ -81,6 +81,11 @@
8181
<version>${project.version}</version>
8282
</dependency>
8383

84+
<dependency>
85+
<groupId>com.sun.xml.bind</groupId>
86+
<artifactId>jaxb-impl</artifactId>
87+
<scope>runtime</scope>
88+
</dependency>
8489
<dependency>
8590
<groupId>org.simpleframework</groupId>
8691
<artifactId>simple-http</artifactId>

agent/apiharness/src/main/java/com/intuit/tank/harness/APIMonitor.java

+8-11
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,14 @@ private CloudVmStatus createStatus(WatsAgentStatusResponse agentStatus) {
105105
* @return
106106
*/
107107
private JobStatus calculateJobStatus(WatsAgentStatusResponse agentStatus, JobStatus currentStatus) {
108-
if (APITestHarness.getInstance().getCmd() == WatsAgentCommand.pause) {
109-
return JobStatus.Paused;
110-
} else if (APITestHarness.getInstance().getCmd() == WatsAgentCommand.stop) {
111-
return JobStatus.Stopped;
112-
} else if (APITestHarness.getInstance().getCmd() == WatsAgentCommand.pause_ramp) {
113-
return JobStatus.RampPaused;
114-
} else if ((currentStatus == JobStatus.Unknown || currentStatus == JobStatus.Starting)
115-
&& agentStatus.getCurrentNumberUsers() > 0) {
116-
return JobStatus.Running;
117-
}
118-
return currentStatus;
108+
WatsAgentCommand cmd = APITestHarness.getInstance().getCmd();
109+
return cmd == WatsAgentCommand.pause ? JobStatus.Paused
110+
: cmd == WatsAgentCommand.stop ? JobStatus.Stopped
111+
: cmd == WatsAgentCommand.pause_ramp ? JobStatus.RampPaused
112+
: currentStatus == JobStatus.Unknown
113+
|| currentStatus == JobStatus.Starting
114+
&& agentStatus.getCurrentNumberUsers() > 0 ? JobStatus.Running
115+
: currentStatus;
119116
}
120117

121118
public static void setDoMonitor(boolean monitor) {

agent/apiharness/src/main/java/com/intuit/tank/harness/APITestHarness.java

+13-27
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import java.util.Vector;
3131
import java.util.concurrent.CountDownLatch;
3232

33-
import com.amazonaws.regions.Regions;
3433
import com.google.common.collect.ImmutableMap;
3534
import com.intuit.tank.http.TankHttpClient;
3635
import org.apache.commons.io.FileUtils;
@@ -43,6 +42,7 @@
4342
import org.apache.logging.log4j.core.LoggerContext;
4443
import org.apache.logging.log4j.core.config.Configuration;
4544
import org.apache.logging.log4j.core.config.LoggerConfig;
45+
import org.apache.logging.log4j.message.ObjectMessage;
4646

4747
import com.intuit.tank.AgentServiceClient;
4848
import com.intuit.tank.api.model.v1.cloud.CloudVmStatus;
@@ -67,7 +67,7 @@
6767
import com.intuit.tank.vm.api.enumerated.WatsAgentCommand;
6868
import com.intuit.tank.vm.common.TankConstants;
6969
import com.intuit.tank.vm.settings.TankConfig;
70-
import org.apache.logging.log4j.message.ObjectMessage;
70+
import software.amazon.awssdk.regions.internal.util.EC2MetadataUtils;
7171

7272
public class APITestHarness {
7373
private static Logger LOG = LogManager.getLogger(APITestHarness.class);
@@ -141,12 +141,13 @@ public static void main(String[] args) {
141141
}
142142

143143
HostInfo hostInfo = new HostInfo();
144-
ThreadContext.put("jobId", getInstance().getAgentRunData().getJobId());
145-
ThreadContext.put("projectName", getInstance().getAgentRunData().getProjectName());
146-
ThreadContext.put("instanceId", getInstance().getAgentRunData().getInstanceId());
144+
ThreadContext.put("jobId", AmazonUtil.getJobId());
145+
ThreadContext.put("projectName", AmazonUtil.getProjectName());
146+
ThreadContext.put("instanceId", AmazonUtil.getInstanceId());
147147
ThreadContext.put("publicIp", hostInfo.getPublicIp());
148-
ThreadContext.put("region", AmazonUtil.getVMRegion().getRegion());
148+
ThreadContext.put("location", AmazonUtil.getZone());
149149
ThreadContext.put("httpHost", AmazonUtil.getControllerBaseUrl());
150+
ThreadContext.put("loggingProfile", AmazonUtil.getLoggingProfile().getDisplayName());
150151

151152
getInstance().initializeFromArgs(args);
152153
}
@@ -302,23 +303,12 @@ private void startHttp(String baseUrl) {
302303
if (capacity < 0) {
303304
capacity = AmazonUtil.getCapacity();
304305
}
305-
VMRegion region = VMRegion.STANDALONE;
306-
if (AmazonUtil.isInAmazon()) {
307-
region = AmazonUtil.getVMRegion();
308-
}
309306
agentRunData.setJobId(AmazonUtil.getJobId());
310307
agentRunData.setStopBehavior(AmazonUtil.getStopBehavior());
311-
312308
LogUtil.getLogEvent().setJobId(agentRunData.getJobId());
313-
ThreadContext.put("jobId", agentRunData.getJobId());
314-
ThreadContext.put("projectName", agentRunData.getProjectName());
315-
ThreadContext.put("instanceId", agentRunData.getInstanceId());
316-
ThreadContext.put("publicIp", hostInfo.getPublicIp());
317-
ThreadContext.put("region", Regions.getCurrentRegion().getName());
318-
ThreadContext.put("httpHost", baseUrl);
319-
LOG.info(new ObjectMessage(ImmutableMap.of("Message", "Active Profile" + agentRunData.getActiveProfile().getDisplayName())));
309+
320310
AgentData data = new AgentData(agentRunData.getJobId(), instanceId, instanceUrl, capacity,
321-
region, AmazonUtil.getZone());
311+
AmazonUtil.getVMRegion(), AmazonUtil.getZone());
322312
try {
323313
AgentTestStartData startData = null;
324314
int count = 0;
@@ -614,12 +604,8 @@ public CloudVmStatus getInitialStatus() {
614604
VMRegion region = VMRegion.STANDALONE;
615605
String secGroups = "unknown";
616606
if (AmazonUtil.isInAmazon()) {
617-
try {
618-
region = AmazonUtil.getVMRegion();
619-
secGroups = AmazonUtil.getMetaData(CloudMetaDataType.security_groups);
620-
} catch (IOException e) {
621-
LOG.warn(new ObjectMessage(ImmutableMap.of("Message", "Error gettting region. using Custom...")));
622-
}
607+
region = AmazonUtil.getVMRegion();
608+
secGroups = EC2MetadataUtils.getSecurityGroups().get(0);
623609
}
624610
status = new CloudVmStatus(instanceId, agentRunData.getJobId(), secGroups, JobStatus.Unknown,
625611
VMImageType.AGENT, region, VMStatus.running,
@@ -713,9 +699,9 @@ public void checkAgentThreads() {
713699
threadGroup.enumerate(threads);
714700
int activeThreads = (int) Arrays.stream(threads).filter(Objects::nonNull).filter(
715701
t -> t.getState() == Thread.State.TIMED_WAITING || t.getState() == Thread.State.WAITING).count();
716-
LOG.info(new ObjectMessage(ImmutableMap.of("Message", "Have " + activeThreads + " of " + activeCount
702+
LOG.info(LogUtil.getLogMessage("Have " + activeThreads + " of " + activeCount
717703
+ " active Threads in thread group "
718-
+ threadGroup.getName())));
704+
+ threadGroup.getName()));
719705
}
720706
if (hasMetSimulationTime()) { // && doneSignal.getCount() != 0) {
721707
LOG.info(LogUtil.getLogMessage("Max simulation time has been met and there are "

agent/apiharness/src/main/java/com/intuit/tank/harness/logging/ThreadLocalLogEvent.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ public LogEvent initialValue() {
4141
ThreadContext.put("projectName", APITestHarness.getInstance().getAgentRunData().getProjectName());
4242
ThreadContext.put("instanceId", APITestHarness.getInstance().getAgentRunData().getInstanceId());
4343
ThreadContext.put("publicIp", hostInfo.getPublicIp());
44-
ThreadContext.put("region", AmazonUtil.getVMRegion().getRegion());
44+
ThreadContext.put("location", AmazonUtil.getZone());
4545
ThreadContext.put("httpHost", AmazonUtil.getControllerBaseUrl());
46+
ThreadContext.put("loggingProfile", APITestHarness.getInstance().getAgentRunData().getActiveProfile().getDisplayName());
4647

4748
return logEvent;
4849

agent/apiharness/src/main/resources/log4j2.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
<KeyValuePair key="projectName" value="$${ctx:projectName:-unknown}"/>
1515
<KeyValuePair key="instanceId" value="$${ctx:instanceId:-unknown}"/>
1616
<KeyValuePair key="publicIp" value="$${ctx:publicIp:-unknown}"/>
17-
<KeyValuePair key="region" value="$${ctx:region:-unknown}"/>
17+
<KeyValuePair key="location" value="$${ctx:location:-unknown}"/>
1818
<KeyValuePair key="httpHost" value="$${ctx:httpHost:-unknown}"/>
19+
<KeyValuePair key="loggingProfile" value="$${ctx:loggingProfile:-unknown}"/>
1920
</JsonLayout>
2021

2122
<Policies>

agent/apiharness/src/test/java/com/intuit/tank/common/TPSTest.java

+8-9
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@
2222
import org.apache.logging.log4j.LogManager;
2323
import org.apache.logging.log4j.Logger;
2424

25-
import com.amazonaws.ClientConfiguration;
26-
import com.amazonaws.auth.AWSCredentials;
27-
import com.amazonaws.auth.BasicAWSCredentials;
28-
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient;
2925
import com.intuit.tank.persistence.databases.AmazonDynamoDatabaseDocApi;
3026
import com.intuit.tank.persistence.databases.DatabaseKeys;
3127
import com.intuit.tank.reporting.api.TPSInfo;
@@ -37,27 +33,30 @@
3733
import org.junit.jupiter.api.BeforeAll;
3834
import org.junit.jupiter.api.Tag;
3935
import org.junit.jupiter.api.Test;
36+
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
37+
import software.amazon.awssdk.auth.credentials.AwsCredentials;
38+
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
39+
import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
4040

4141
public class TPSTest {
4242
private static final Logger LOG = LogManager.getLogger(TPSTest.class);
4343

44-
private AmazonDynamoDBClient dbclient;
44+
private DynamoDbClient dynamoDbClient;
4545

4646
@BeforeAll
4747
@Tag(TestGroups.EXPERIMENTAL)
4848
public void init() {
49-
ClientConfiguration clientConfig = new ClientConfiguration();
50-
AWSCredentials credentials = new BasicAWSCredentials(System.getProperty("AWS_KEY_ID"),
49+
AwsCredentials credentials = AwsBasicCredentials.create(System.getProperty("AWS_KEY_ID"),
5150
System.getProperty("AWS_KEY"));
52-
dbclient = new AmazonDynamoDBClient(credentials, clientConfig);
51+
dynamoDbClient = DynamoDbClient.builder().credentialsProvider(StaticCredentialsProvider.create(credentials)).build();
5352
}
5453

5554
@Test
5655
@Tag(TestGroups.EXPERIMENTAL)
5756
private void sendTps() {
5857
TPSInfoContainer tpsInfo = createTPsInfo();
5958
try {
60-
IDatabase db = new AmazonDynamoDatabaseDocApi(dbclient);
59+
IDatabase db = new AmazonDynamoDatabaseDocApi(dynamoDbClient);
6160
List<com.intuit.tank.reporting.databases.Item> items = new ArrayList<com.intuit.tank.reporting.databases.Item>();
6261
for (TPSInfo info : tpsInfo.getTpsInfos()) {
6362
com.intuit.tank.reporting.databases.Item item = createItem(info);

agent/apiharness_pkg/pom.xml

+1-6
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,22 @@
66
<parent>
77
<groupId>com.intuit.tank</groupId>
88
<artifactId>agent-parent</artifactId>
9-
<version>2.3.4</version>
9+
<version>3.0.0</version>
1010
</parent>
1111

12-
1312
<artifactId>apiharness</artifactId>
1413

1514
<packaging>pom</packaging>
1615
<name>Apiharness Packaging</name>
1716

18-
1917
<dependencies>
20-
2118
<dependency>
2219
<groupId>${project.groupId}</groupId>
2320
<artifactId>agent</artifactId>
2421
<version>${project.version}</version>
2522
</dependency>
2623
</dependencies>
2724

28-
29-
3025
<build>
3126
<plugins>
3227
<plugin>

agent/http_client_3/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.intuit.tank</groupId>
77
<artifactId>agent-parent</artifactId>
8-
<version>2.3.4</version>
8+
<version>3.0.0</version>
99
</parent>
1010

1111
<artifactId>http_client_commons_3</artifactId>

0 commit comments

Comments
 (0)