Skip to content

Commit

Permalink
Release 3.0.0
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
12 people authored Nov 3, 2020
1 parent d1c505b commit 0cad65f
Show file tree
Hide file tree
Showing 208 changed files with 4,238 additions and 1,822 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
language: java
jdk:
- openjdk8
- openjdk11

env:
- SKIP_METHODTIMER_TEST=true

script: mvn clean install -P default,coverage
7 changes: 6 additions & 1 deletion agent/agent_common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.intuit.tank</groupId>
<artifactId>agent-parent</artifactId>
<version>2.3.4</version>
<version>3.0.0</version>
</parent>

<artifactId>agent-common</artifactId>
Expand Down Expand Up @@ -36,6 +36,11 @@
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
</dependency>

<dependency>
<groupId>jakarta.xml.ws</groupId>
<artifactId>jakarta.xml.ws-api</artifactId>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.jdom2.JDOMException;
import org.jdom2.Namespace;
import org.jdom2.input.SAXBuilder;
import org.jdom2.input.sax.XMLReaders;
import org.jdom2.output.XMLOutputter;
import org.jdom2.xpath.XPath;
import org.xml.sax.InputSource;
Expand Down Expand Up @@ -72,7 +73,7 @@ public GenericXMLHandler(File xmlFile) {
this.xmlFile = xmlFile;
this.xmlDocument = new org.jdom2.Document();
SAXBuilder builder = new SAXBuilder();
builder.setValidation(false);
builder.setXMLReaderFactory(XMLReaders.NONVALIDATING);
this.xmlDocument = builder.build(this.xmlFile);
this.namespaces = new HashMap<String, String>();
} catch (Exception ex) {
Expand All @@ -94,7 +95,7 @@ public GenericXMLHandler(String xmlFile) {
this.xmlFile = null;
this.xmlDocument = new org.jdom2.Document();
SAXBuilder builder = new SAXBuilder();
builder.setValidation(false);
builder.setXMLReaderFactory(XMLReaders.NONVALIDATING);
// LOG.debug("XML string to load: "+xmlFile);
xmlFile = xmlFile.substring(xmlFile.indexOf("<"));
this.xmlDocument = builder.build(new StringReader(xmlFile));
Expand Down Expand Up @@ -156,6 +157,7 @@ private Element SetElementText(String xPathExpression, int currentNode) throws J
if (xPathExists(currentPath)) {
if (currentPath.equals(xPathExpression)) {
return (org.jdom2.Element) XPath.selectSingleNode(this.xmlDocument, xPathExpression);

}
else {
return SetElementText(xPathExpression, currentNode + 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

/**
Expand Down Expand Up @@ -129,6 +130,7 @@ public void testGetKey_1()
* @generatedBy CodePro at 12/16/14 4:29 PM
*/
@Test
@Disabled
public void testSetKey_1()
throws Exception {
SOAPRequest fixture = new SOAPRequest(null, null);
Expand Down
2 changes: 1 addition & 1 deletion agent/agent_standalone/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.intuit.tank</groupId>
<artifactId>agent-parent</artifactId>
<version>2.3.4</version>
<version>3.0.0</version>
</parent>

<artifactId>agent-standalone</artifactId>
Expand Down
3 changes: 2 additions & 1 deletion agent/agent_standalone_pkg/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.intuit.tank</groupId>
<artifactId>agent-parent</artifactId>
<version>2.3.4</version>
<version>3.0.0</version>
</parent>

<artifactId>agent-standalone-pkg</artifactId>
Expand Down Expand Up @@ -40,6 +40,7 @@
<finalName>agent-standalone</finalName>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
<descriptor>src/main/assembly/zip-assembly.xml</descriptor>
</descriptors>
<archive>
<manifest>
Expand Down
2 changes: 1 addition & 1 deletion agent/agent_startup/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.intuit.tank</groupId>
<artifactId>agent-parent</artifactId>
<version>2.3.4</version>
<version>3.0.0</version>
</parent>

<artifactId>agent-startup</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
import java.util.zip.ZipException;
import java.util.zip.ZipInputStream;

import com.amazonaws.util.StringUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.intuit.tank.harness.AmazonUtil;
import com.intuit.tank.vm.common.TankConstants;
import software.amazon.awssdk.utils.StringUtils;

public class AgentStartup implements Runnable {
private static Logger logger = LogManager.getLogger(AgentStartup.class);
Expand Down Expand Up @@ -110,7 +110,7 @@ public static void main(String[] args) {
controllerBaseUrl = values[1];
}
}
if (StringUtils.isNullOrEmpty(controllerBaseUrl)) {
if (StringUtils.isEmpty(controllerBaseUrl)) {
controllerBaseUrl = AmazonUtil.getControllerBaseUrl();
}
AgentStartup agentStartup = new AgentStartup(controllerBaseUrl);
Expand Down
2 changes: 1 addition & 1 deletion agent/agent_startup_pkg/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.intuit.tank</groupId>
<artifactId>agent-parent</artifactId>
<version>2.3.4</version>
<version>3.0.0</version>
</parent>

<artifactId>agent-startup-pkg</artifactId>
Expand Down
7 changes: 6 additions & 1 deletion agent/apiharness/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.intuit.tank</groupId>
<artifactId>agent-parent</artifactId>
<version>2.3.4</version>
<version>3.0.0</version>
</parent>

<artifactId>agent</artifactId>
Expand Down Expand Up @@ -81,6 +81,11 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.simpleframework</groupId>
<artifactId>simple-http</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,14 @@ private CloudVmStatus createStatus(WatsAgentStatusResponse agentStatus) {
* @return
*/
private JobStatus calculateJobStatus(WatsAgentStatusResponse agentStatus, JobStatus currentStatus) {
if (APITestHarness.getInstance().getCmd() == WatsAgentCommand.pause) {
return JobStatus.Paused;
} else if (APITestHarness.getInstance().getCmd() == WatsAgentCommand.stop) {
return JobStatus.Stopped;
} else if (APITestHarness.getInstance().getCmd() == WatsAgentCommand.pause_ramp) {
return JobStatus.RampPaused;
} else if ((currentStatus == JobStatus.Unknown || currentStatus == JobStatus.Starting)
&& agentStatus.getCurrentNumberUsers() > 0) {
return JobStatus.Running;
}
return currentStatus;
WatsAgentCommand cmd = APITestHarness.getInstance().getCmd();
return cmd == WatsAgentCommand.pause ? JobStatus.Paused
: cmd == WatsAgentCommand.stop ? JobStatus.Stopped
: cmd == WatsAgentCommand.pause_ramp ? JobStatus.RampPaused
: currentStatus == JobStatus.Unknown
|| currentStatus == JobStatus.Starting
&& agentStatus.getCurrentNumberUsers() > 0 ? JobStatus.Running
: currentStatus;
}

public static void setDoMonitor(boolean monitor) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import java.util.Vector;
import java.util.concurrent.CountDownLatch;

import com.amazonaws.regions.Regions;
import com.google.common.collect.ImmutableMap;
import com.intuit.tank.http.TankHttpClient;
import org.apache.commons.io.FileUtils;
Expand All @@ -43,6 +42,7 @@
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.config.Configuration;
import org.apache.logging.log4j.core.config.LoggerConfig;
import org.apache.logging.log4j.message.ObjectMessage;

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

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

HostInfo hostInfo = new HostInfo();
ThreadContext.put("jobId", getInstance().getAgentRunData().getJobId());
ThreadContext.put("projectName", getInstance().getAgentRunData().getProjectName());
ThreadContext.put("instanceId", getInstance().getAgentRunData().getInstanceId());
ThreadContext.put("jobId", AmazonUtil.getJobId());
ThreadContext.put("projectName", AmazonUtil.getProjectName());
ThreadContext.put("instanceId", AmazonUtil.getInstanceId());
ThreadContext.put("publicIp", hostInfo.getPublicIp());
ThreadContext.put("region", AmazonUtil.getVMRegion().getRegion());
ThreadContext.put("location", AmazonUtil.getZone());
ThreadContext.put("httpHost", AmazonUtil.getControllerBaseUrl());
ThreadContext.put("loggingProfile", AmazonUtil.getLoggingProfile().getDisplayName());

getInstance().initializeFromArgs(args);
}
Expand Down Expand Up @@ -302,23 +303,12 @@ private void startHttp(String baseUrl) {
if (capacity < 0) {
capacity = AmazonUtil.getCapacity();
}
VMRegion region = VMRegion.STANDALONE;
if (AmazonUtil.isInAmazon()) {
region = AmazonUtil.getVMRegion();
}
agentRunData.setJobId(AmazonUtil.getJobId());
agentRunData.setStopBehavior(AmazonUtil.getStopBehavior());

LogUtil.getLogEvent().setJobId(agentRunData.getJobId());
ThreadContext.put("jobId", agentRunData.getJobId());
ThreadContext.put("projectName", agentRunData.getProjectName());
ThreadContext.put("instanceId", agentRunData.getInstanceId());
ThreadContext.put("publicIp", hostInfo.getPublicIp());
ThreadContext.put("region", Regions.getCurrentRegion().getName());
ThreadContext.put("httpHost", baseUrl);
LOG.info(new ObjectMessage(ImmutableMap.of("Message", "Active Profile" + agentRunData.getActiveProfile().getDisplayName())));

AgentData data = new AgentData(agentRunData.getJobId(), instanceId, instanceUrl, capacity,
region, AmazonUtil.getZone());
AmazonUtil.getVMRegion(), AmazonUtil.getZone());
try {
AgentTestStartData startData = null;
int count = 0;
Expand Down Expand Up @@ -614,12 +604,8 @@ public CloudVmStatus getInitialStatus() {
VMRegion region = VMRegion.STANDALONE;
String secGroups = "unknown";
if (AmazonUtil.isInAmazon()) {
try {
region = AmazonUtil.getVMRegion();
secGroups = AmazonUtil.getMetaData(CloudMetaDataType.security_groups);
} catch (IOException e) {
LOG.warn(new ObjectMessage(ImmutableMap.of("Message", "Error gettting region. using Custom...")));
}
region = AmazonUtil.getVMRegion();
secGroups = EC2MetadataUtils.getSecurityGroups().get(0);
}
status = new CloudVmStatus(instanceId, agentRunData.getJobId(), secGroups, JobStatus.Unknown,
VMImageType.AGENT, region, VMStatus.running,
Expand Down Expand Up @@ -713,9 +699,9 @@ public void checkAgentThreads() {
threadGroup.enumerate(threads);
int activeThreads = (int) Arrays.stream(threads).filter(Objects::nonNull).filter(
t -> t.getState() == Thread.State.TIMED_WAITING || t.getState() == Thread.State.WAITING).count();
LOG.info(new ObjectMessage(ImmutableMap.of("Message", "Have " + activeThreads + " of " + activeCount
LOG.info(LogUtil.getLogMessage("Have " + activeThreads + " of " + activeCount
+ " active Threads in thread group "
+ threadGroup.getName())));
+ threadGroup.getName()));
}
if (hasMetSimulationTime()) { // && doneSignal.getCount() != 0) {
LOG.info(LogUtil.getLogMessage("Max simulation time has been met and there are "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ public LogEvent initialValue() {
ThreadContext.put("projectName", APITestHarness.getInstance().getAgentRunData().getProjectName());
ThreadContext.put("instanceId", APITestHarness.getInstance().getAgentRunData().getInstanceId());
ThreadContext.put("publicIp", hostInfo.getPublicIp());
ThreadContext.put("region", AmazonUtil.getVMRegion().getRegion());
ThreadContext.put("location", AmazonUtil.getZone());
ThreadContext.put("httpHost", AmazonUtil.getControllerBaseUrl());
ThreadContext.put("loggingProfile", APITestHarness.getInstance().getAgentRunData().getActiveProfile().getDisplayName());

return logEvent;

Expand Down
3 changes: 2 additions & 1 deletion agent/apiharness/src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
<KeyValuePair key="projectName" value="$${ctx:projectName:-unknown}"/>
<KeyValuePair key="instanceId" value="$${ctx:instanceId:-unknown}"/>
<KeyValuePair key="publicIp" value="$${ctx:publicIp:-unknown}"/>
<KeyValuePair key="region" value="$${ctx:region:-unknown}"/>
<KeyValuePair key="location" value="$${ctx:location:-unknown}"/>
<KeyValuePair key="httpHost" value="$${ctx:httpHost:-unknown}"/>
<KeyValuePair key="loggingProfile" value="$${ctx:loggingProfile:-unknown}"/>
</JsonLayout>

<Policies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.amazonaws.ClientConfiguration;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient;
import com.intuit.tank.persistence.databases.AmazonDynamoDatabaseDocApi;
import com.intuit.tank.persistence.databases.DatabaseKeys;
import com.intuit.tank.reporting.api.TPSInfo;
Expand All @@ -37,27 +33,30 @@
import org.junit.jupiter.api.BeforeAll;
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;

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

private AmazonDynamoDBClient dbclient;
private DynamoDbClient dynamoDbClient;

@BeforeAll
@Tag(TestGroups.EXPERIMENTAL)
public void init() {
ClientConfiguration clientConfig = new ClientConfiguration();
AWSCredentials credentials = new BasicAWSCredentials(System.getProperty("AWS_KEY_ID"),
AwsCredentials credentials = AwsBasicCredentials.create(System.getProperty("AWS_KEY_ID"),
System.getProperty("AWS_KEY"));
dbclient = new AmazonDynamoDBClient(credentials, clientConfig);
dynamoDbClient = DynamoDbClient.builder().credentialsProvider(StaticCredentialsProvider.create(credentials)).build();
}

@Test
@Tag(TestGroups.EXPERIMENTAL)
private void sendTps() {
TPSInfoContainer tpsInfo = createTPsInfo();
try {
IDatabase db = new AmazonDynamoDatabaseDocApi(dbclient);
IDatabase db = new AmazonDynamoDatabaseDocApi(dynamoDbClient);
List<com.intuit.tank.reporting.databases.Item> items = new ArrayList<com.intuit.tank.reporting.databases.Item>();
for (TPSInfo info : tpsInfo.getTpsInfos()) {
com.intuit.tank.reporting.databases.Item item = createItem(info);
Expand Down
7 changes: 1 addition & 6 deletions agent/apiharness_pkg/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,22 @@
<parent>
<groupId>com.intuit.tank</groupId>
<artifactId>agent-parent</artifactId>
<version>2.3.4</version>
<version>3.0.0</version>
</parent>


<artifactId>apiharness</artifactId>

<packaging>pom</packaging>
<name>Apiharness Packaging</name>


<dependencies>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>agent</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>



<build>
<plugins>
<plugin>
Expand Down
2 changes: 1 addition & 1 deletion agent/http_client_3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.intuit.tank</groupId>
<artifactId>agent-parent</artifactId>
<version>2.3.4</version>
<version>3.0.0</version>
</parent>

<artifactId>http_client_commons_3</artifactId>
Expand Down
Loading

0 comments on commit 0cad65f

Please sign in to comment.