Skip to content

Commit 69e36f3

Browse files
Release 2.3.3
* Remove decompress apache httpclient 4.5.x does it automatically * thread should end when loops end. * Enable compression request to tank clients * AWS X-ray instrumentation * Reduce pending to running wait from 1min to 30sec * Enable Referer and Authorization headers, Test and documentation * trace recent jobs query * Performance & Size Reduction * Cache agent-support-files.zip in /tmp * Replace deprecated hibernate index annotations with JPA index annotations * Library reorganization saved 43MB off deployment war * AWS Xray + DBQueries + Performance * Cleanup * RequestScoped bean to ApplicationScoped bean * AWSXray dummy segments to allow jdbc tracing to be enabled * LazyLoad User Table * BatchSize * userAdmin Fix + CriteriaBuilder * better error handling on UserDao
1 parent b75a901 commit 69e36f3

File tree

193 files changed

+1086
-1025
lines changed

Some content is hidden

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

193 files changed

+1086
-1025
lines changed

agent/agent_common/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.2</version>
8+
<version>2.3.3</version>
99
</parent>
1010

1111
<artifactId>agent-common</artifactId>

agent/agent_common/src/main/java/com/intuit/tank/http/BaseResponse.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,13 @@ public void logResponse() {
226226
}
227227

228228
public static final boolean isDataType(String contentType) {
229-
boolean ret = false;
230229
if (!StringUtils.isBlank(contentType)) {
231230
contentType = contentType.toLowerCase();
232-
ret = contentType.contains("html") || contentType.contains("text") || contentType.contains("json") || contentType.contains("xml");
231+
return contentType.contains("html") ||
232+
contentType.contains("text") ||
233+
contentType.contains("json") ||
234+
contentType.contains("xml");
233235
}
234-
return ret;
236+
return false;
235237
}
236238
}

agent/agent_common/src/main/java/com/intuit/tank/http/TankHttpUtil.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import java.net.MalformedURLException;
66
import java.net.URL;
77
import java.net.URLEncoder;
8-
import java.nio.charset.Charset;
98
import java.nio.charset.StandardCharsets;
109
import java.util.ArrayList;
1110
import java.util.HashMap;
@@ -22,6 +21,7 @@
2221
import com.intuit.tank.http.binary.BinaryResponse;
2322
import com.intuit.tank.http.json.JsonResponse;
2423
import com.intuit.tank.http.xml.XMLResponse;
24+
2525
/**
2626
* utitly methods for tank http clients
2727
* @author denisa
@@ -177,7 +177,7 @@ public byte[] getBody() {
177177
* @return the body as a string
178178
*/
179179
public String getBodyAsString() {
180-
return new String(body, Charset.forName("UTF-8"));
180+
return new String(body, StandardCharsets.UTF_8);
181181
}
182182

183183
// Content-Disposition: form-data; name="uploadname1";

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.2</version>
8+
<version>2.3.3</version>
99
</parent>
1010

1111
<artifactId>agent-standalone</artifactId>

agent/agent_standalone_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.2</version>
8+
<version>2.3.3</version>
99
</parent>
1010

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

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.2</version>
8+
<version>2.3.3</version>
99
</parent>
1010

1111
<artifactId>agent-startup</artifactId>

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

+21-28
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.zip.ZipEntry;
2222
import java.util.zip.ZipInputStream;
2323

24+
import com.amazonaws.util.StringUtils;
2425
import org.apache.commons.io.FileUtils;
2526
import org.apache.commons.io.IOUtils;
2627
import org.apache.logging.log4j.LogManager;
@@ -32,40 +33,30 @@
3233
public class AgentStartup implements Runnable {
3334

3435
private static Logger logger = LogManager.getLogger(AgentStartup.class);
35-
public static final String SERVICE_RELATIVE_PATH = "/rest/v1/agent-service";
36-
public static final String METHOD_SETTINGS = "/settings";
37-
private static String API_HARNESS_COMMAND = "./startAgent.sh";
38-
public static final String METHOD_SUPPORT = "/supportFiles";
39-
private static final long WAIT_FOR_RESTART_TIME = 00000; // zero minute
36+
private static final String SERVICE_RELATIVE_PATH = "/rest/v1/agent-service";
37+
private static final String METHOD_SETTINGS = "/settings";
38+
private static final String API_HARNESS_COMMAND = "./startAgent.sh";
39+
private static final String METHOD_SUPPORT = "/supportFiles";
4040

41-
private String controllerBase;
41+
private final String controllerBaseUrl;
42+
43+
public AgentStartup (String controllerBaseUrl ) {
44+
this.controllerBaseUrl = controllerBaseUrl;
45+
}
4246

4347
public void run() {
4448
logger.info("Starting up...");
45-
if (AmazonUtil.usingEip()) {
46-
try {
47-
logger.info("Using EIP. Sleeping for " + WAIT_FOR_RESTART_TIME + " ms.");
48-
Thread.sleep(WAIT_FOR_RESTART_TIME);
49-
} catch (InterruptedException e1) {
50-
logger.info("Exception waiting.");
51-
System.exit(0);
52-
}
53-
}
5449
try {
55-
if (controllerBase == null) {
56-
controllerBase = AmazonUtil.getControllerBaseUrl();
57-
}
58-
59-
logger.info("Starting up: ControllerBaseUrl=" + controllerBase);
60-
URL url = new URL(controllerBase + SERVICE_RELATIVE_PATH + METHOD_SETTINGS);
50+
logger.info("Starting up: ControllerBaseUrl=" + controllerBaseUrl);
51+
URL url = new URL(controllerBaseUrl + SERVICE_RELATIVE_PATH + METHOD_SETTINGS);
6152
logger.info("Starting up: making call to tank service url to get settings.xml "
6253
+ url.toExternalForm());
6354
try ( InputStream settingsStream = url.openStream() ) {
6455
String settings = IOUtils.toString(settingsStream, StandardCharsets.UTF_8);
6556
FileUtils.writeStringToFile(new File("settings.xml"), settings, StandardCharsets.UTF_8);
6657
logger.info("got settings file...");
6758
}
68-
url = new URL(controllerBase + SERVICE_RELATIVE_PATH + METHOD_SUPPORT);
59+
url = new URL(controllerBaseUrl + SERVICE_RELATIVE_PATH + METHOD_SUPPORT);
6960
logger.info("Making call to tank service url to get support files " + url.toExternalForm());
7061
try ( ZipInputStream zip = new ZipInputStream(url.openStream()) ){
7162
ZipEntry entry = zip.getNextEntry();
@@ -81,17 +72,16 @@ public void run() {
8172
}
8273
// now start the harness
8374
String jvmArgs = AmazonUtil.getUserDataAsMap().get(TankConstants.KEY_JVM_ARGS);
84-
logger.info("Starting apiharness with command: " + API_HARNESS_COMMAND + " -http=" + controllerBase + " "
75+
logger.info("Starting apiharness with command: " + API_HARNESS_COMMAND + " -http=" + controllerBaseUrl + " "
8576
+ jvmArgs);
86-
Runtime.getRuntime().exec(API_HARNESS_COMMAND + " -http=" + controllerBase + " " + jvmArgs);
77+
Runtime.getRuntime().exec(API_HARNESS_COMMAND + " -http=" + controllerBaseUrl + " " + jvmArgs);
8778
} catch (Exception e) {
8879
logger.error("Error in AgentStartup " + e, e);
8980
}
9081
}
9182

9283
public static void main(String[] args) {
93-
AgentStartup agentStartup = new AgentStartup();
94-
84+
String controllerBaseUrl = null;
9585
for (String argument : args) {
9686
String[] values = argument.split("=");
9787

@@ -100,10 +90,13 @@ public static void main(String[] args) {
10090
usage();
10191
return;
10292
}
103-
agentStartup.controllerBase = values[1];
93+
controllerBaseUrl = values[1];
10494
}
105-
10695
}
96+
if (StringUtils.isNullOrEmpty(controllerBaseUrl)) {
97+
controllerBaseUrl = AmazonUtil.getControllerBaseUrl();
98+
}
99+
AgentStartup agentStartup = new AgentStartup(controllerBaseUrl);
107100
agentStartup.run();
108101
}
109102

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.2</version>
8+
<version>2.3.3</version>
99
</parent>
1010

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

agent/apiharness/pom.xml

+1-7
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.2</version>
8+
<version>2.3.3</version>
99
</parent>
1010

1111
<artifactId>agent</artifactId>
@@ -57,12 +57,6 @@
5757
<version>${project.version}</version>
5858
</dependency>
5959

60-
<dependency>
61-
<groupId>${project.groupId}</groupId>
62-
<artifactId>tank-common</artifactId>
63-
<version>${project.version}</version>
64-
</dependency>
65-
6660
<dependency>
6761
<groupId>${project.groupId}</groupId>
6862
<artifactId>agent-common</artifactId>

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ public synchronized void threadComplete() {
658658
long count = doneSignal.getCount();
659659
// numCompletedThreads = (int) (agentRunData.getNumUsers() - count);
660660
if (isDebug() || count < 10) {
661-
LOG.info(new ObjectMessage(ImmutableMap.of("Message", "User thread finished... Remaining->" + currentUsers)));
661+
LOG.info(new ObjectMessage(ImmutableMap.of("Message", "User thread finished... Remaining = " + currentUsers)));
662662
}
663663
}
664664

agent/apiharness/src/main/java/com/intuit/tank/harness/functions/JexlStringFunctions.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import java.net.URLDecoder;
2121
import java.net.URLEncoder;
22-
import java.nio.charset.Charset;
2322
import java.nio.charset.StandardCharsets;
2423
import java.text.SimpleDateFormat;
2524
import java.util.Collections;
@@ -487,7 +486,7 @@ public String randomAlphaMixedNumericSpecial(int length) {
487486
public String toBase64(String toEncode) {
488487
try {
489488
byte[] bytes = toEncode.getBytes();
490-
return new String(Base64.encodeBase64(bytes), Charset.forName("utf-8")).trim();
489+
return new String(Base64.encodeBase64(bytes), StandardCharsets.UTF_8).trim();
491490
} catch (Exception e) {
492491
LOG.error("Error base64 encoding " + toEncode + ": " + e);
493492
}
@@ -504,7 +503,7 @@ public String toBase64(String toEncode) {
504503
public String fromBase64(String toDecode) {
505504
try {
506505
byte[] bytes = Base64.decodeBase64(toDecode.trim());
507-
return new String(bytes, Charset.forName("utf-8"));
506+
return new String(bytes, StandardCharsets.UTF_8);
508507
} catch (Exception e) {
509508
LOG.error("Error base64 decoding " + toDecode + ": " + e);
510509
}

agent/apiharness/src/main/java/com/intuit/tank/runner/TestPlanRunner.java

+5-16
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ public void run() {
121121
List<HDScriptGroup> group = testPlan.getGroup();
122122
try {
123123
int i = 0;
124-
int loopCount = 1;
125124

126125
mainLoop: while (i < group.size()) {
127126
HDScriptGroup hdScriptGroup = group.get(i);
@@ -144,7 +143,6 @@ public void run() {
144143
break;
145144
} catch (RestartScriptException e) {
146145
i = 0;
147-
loopCount = 1;
148146
continue mainLoop;
149147
}
150148
if (isCompleted(RunPhase.group, finished)) {
@@ -156,16 +154,8 @@ public void run() {
156154
if (group.get(group.size() - 1) != hdScriptGroup) {
157155
i++;
158156
} else {
159-
finished = true;
160-
if (isCompleted(RunPhase.test, finished)) {
161-
LOG.info(LogUtil.getLogMessage("finished or Stop set to test or less, exiting at test..."));
162-
return;
163-
}
164-
i = 0;
165-
loopCount++;
166-
LOG.info(LogUtil.getLogMessage("Test for test plan " + testPlan.getTestPlanName()
167-
+ " has finished and is now starting over for the "
168-
+ loopCount + " time"));
157+
// All Threads should end after loops complete.
158+
return;
169159
}
170160
}
171161
} catch (Throwable e) {
@@ -176,8 +166,8 @@ public void run() {
176166
}
177167
}
178168

179-
private void runTestGroup(List<HDScript> scripts, HDScriptGroup parent) throws KillScriptException,
180-
RestartScriptException {
169+
private void runTestGroup(List<HDScript> scripts, HDScriptGroup parent)
170+
throws KillScriptException, RestartScriptException {
181171
MethodTimer mt = new MethodTimer(LOG, getClass(), "runScriptGroup(" + parent.getName() + ")");
182172
LogEvent logEvent = LogUtil.getLogEvent();
183173
try {
@@ -222,8 +212,7 @@ private void runTestGroup(List<HDScript> scripts, HDScriptGroup parent) throws K
222212
APITestHarness.getInstance().getUserTracker().remove(hdscript.getName());
223213
}
224214
if (shouldStop(RunPhase.script)) {
225-
LOG.info(LogUtil.getLogMessage("Stop set to script or less, exiting at script " + hdscript.getName()));
226-
return;
215+
throw new KillScriptException("Stop set to script or less, exiting at script " + hdscript.getName());
227216
}
228217
}
229218
} finally {

agent/apiharness_pkg/pom.xml

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

1212

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.2</version>
8+
<version>2.3.3</version>
99
</parent>
1010

1111
<artifactId>http_client_commons_3</artifactId>

agent/http_client_3/src/main/java/com/intuit/tank/httpclient3/TankHttpClient3.java

+5-13
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
* #L%
1616
*/
1717

18-
import java.io.ByteArrayOutputStream;
1918
import java.io.IOException;
2019
import java.io.InputStream;
2120
import java.io.UnsupportedEncodingException;
@@ -353,18 +352,11 @@ private void processResponse(byte[] bResponse, long waitTime, BaseRequest reques
353352
}
354353
}
355354
response.setResponseTime(waitTime);
356-
String contentType = response.getHttpHeader("Content-Type");
357-
String contentEncode = response.getHttpHeader("Content-Encoding");
358-
if (BaseResponse.isDataType(contentType) && contentEncode != null && contentEncode.toLowerCase().contains("gzip")) {
359-
// decode gzip for data types
360-
try ( GZIPInputStream in = new GZIPInputStream(new ByteArrayInputStream(bResponse));
361-
ByteArrayOutputStream out = new ByteArrayOutputStream() ) {
362-
IOUtils.copy(in, out);
363-
bResponse = out.toByteArray();
364-
} catch (IOException | NullPointerException e) {
365-
LOG.warn(request.getLogUtil().getLogMessage("cannot decode gzip stream: " + e, LogEventType.System));
366-
}
367-
}
355+
356+
String contentEncoding = response.getHttpHeader("Content-Encoding");
357+
bResponse = StringUtils.equalsIgnoreCase(contentEncoding, "gzip") ?
358+
IOUtils.toByteArray(new GZIPInputStream(new ByteArrayInputStream(bResponse))) :
359+
bResponse;
368360
response.setResponseBody(bResponse);
369361

370362
} catch (Exception ex) {

agent/http_client_4/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.2</version>
8+
<version>2.3.3</version>
99
</parent>
1010

1111
<artifactId>http_client_commons_4</artifactId>

0 commit comments

Comments
 (0)