Skip to content

Commit 67b21be

Browse files
Release 3.0.2
* Primefaces 10.0.0 * remove prettyfaces * Pass UserData as JSON * AgentStartup java HttpClient * CodeCoverage 36% -> 44% * Library Updates * yum tomcat9
1 parent d99c701 commit 67b21be

File tree

139 files changed

+2202
-1752
lines changed

Some content is hidden

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

139 files changed

+2202
-1752
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ jdk:
44

55
env:
66
- SKIP_METHODTIMER_TEST=true
7+
- SKIP_GUI_TEST=true
78

89
script: mvn clean install -P default,coverage

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>3.0.1</version>
8+
<version>3.0.2</version>
99
</parent>
1010

1111
<artifactId>agent-common</artifactId>

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>3.0.1</version>
8+
<version>3.0.2</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>3.0.1</version>
8+
<version>3.0.2</version>
99
</parent>
1010

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

agent/agent_startup/pom.xml

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

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

1313
<packaging>jar</packaging>
1414
<name>Agent Startup</name>
1515

16-
17-
1816
<dependencies>
19-
2017
<dependency>
2118
<groupId>${project.groupId}</groupId>
2219
<artifactId>api</artifactId>
2320
<version>${project.version}</version>
2421
</dependency>
25-
2622
</dependencies>
2723

2824
</project>

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

+11-17
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@
1616
import java.io.EOFException;
1717
import java.io.File;
1818
import java.io.FileOutputStream;
19-
import java.io.InputStream;
19+
import java.io.IOException;
2020
import java.net.ConnectException;
2121
import java.net.URL;
22-
import java.nio.charset.StandardCharsets;
2322
import java.util.zip.ZipEntry;
2423
import java.util.zip.ZipException;
2524
import java.util.zip.ZipInputStream;
@@ -34,7 +33,7 @@
3433
import software.amazon.awssdk.utils.StringUtils;
3534

3635
public class AgentStartup implements Runnable {
37-
private static Logger logger = LogManager.getLogger(AgentStartup.class);
36+
private static final Logger logger = LogManager.getLogger(AgentStartup.class);
3837
private static final String SERVICE_RELATIVE_PATH = "/rest/v1/agent-service";
3938
private static final String METHOD_SETTINGS = "/settings";
4039
private static final String API_HARNESS_COMMAND = "./startAgent.sh";
@@ -54,14 +53,8 @@ public void run() {
5453
URL url = new URL(controllerBaseUrl + SERVICE_RELATIVE_PATH + METHOD_SETTINGS);
5554
logger.info("Starting up: making call to tank service url to get settings.xml "
5655
+ url.toExternalForm());
57-
try ( InputStream settingsStream = url.openStream() ) {
58-
String settings = IOUtils.toString(settingsStream, StandardCharsets.UTF_8);
59-
FileUtils.writeStringToFile(new File("settings.xml"), settings, StandardCharsets.UTF_8);
60-
logger.info("got settings file...");
61-
} catch (ConnectException ce) {
62-
logger.error("Error creating connection to "
63-
+ controllerBaseUrl + " : this is normal during the bake : " + ce.getMessage());
64-
}
56+
FileUtils.copyURLToFile(url, new File("settings.xml"));
57+
logger.info("got settings file...");
6558
// Download Support Files
6659
url = new URL(controllerBaseUrl + SERVICE_RELATIVE_PATH + METHOD_SUPPORT);
6760
logger.info("Making call to tank service url to get support files " + url.toExternalForm());
@@ -92,9 +85,12 @@ public void run() {
9285
logger.info("Starting apiharness with command: "
9386
+ API_HARNESS_COMMAND + " -http=" + controllerBaseUrl + " " + jvmArgs);
9487
Runtime.getRuntime().exec(API_HARNESS_COMMAND + " -http=" + controllerBaseUrl + " " + jvmArgs);
95-
} catch (Exception e) {
96-
logger.error("Error in AgentStartup " + e, e);
97-
}
88+
} catch (ConnectException ce) {
89+
logger.error("Error creating connection to "
90+
+ controllerBaseUrl + " : this is normal during the bake : " + ce.getMessage());
91+
} catch (IOException e) {
92+
logger.error("Error Executing API Harness Command: " + API_HARNESS_COMMAND + ": " + e, e);
93+
} catch (InterruptedException e) {}
9894
}
9995

10096
public static void main(String[] args) {
@@ -122,9 +118,7 @@ public static void main(String[] args) {
122118
*/
123119
private static void usage() {
124120
System.out.println("Tank Test Startup Usage:");
125-
System.out
126-
.println("java -cp agent-startup-pkg-1.0-all.jar com/intuit/tank/agent/AgentStartup <options>");
121+
System.out.println("java -cp agent-startup-pkg-1.0-all.jar com/intuit/tank/agent/AgentStartup <options>");
127122
System.out.println("-controller=<controller_base_url>: The url of the controller to get test info from");
128123
}
129-
130124
}

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>3.0.1</version>
8+
<version>3.0.2</version>
99
</parent>
1010

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

agent/apiharness/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>3.0.1</version>
8+
<version>3.0.2</version>
99
</parent>
1010

1111
<artifactId>agent</artifactId>

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>3.0.1</version>
9+
<version>3.0.2</version>
1010
</parent>
1111

1212
<artifactId>apiharness</artifactId>

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>3.0.1</version>
8+
<version>3.0.2</version>
99
</parent>
1010

1111
<artifactId>http_client_apache_3</artifactId>

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>3.0.1</version>
8+
<version>3.0.2</version>
99
</parent>
1010

1111
<artifactId>http_client_apache_4</artifactId>

agent/http_client_5/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>3.0.1</version>
8+
<version>3.0.2</version>
99
</parent>
1010

1111
<artifactId>http_client_apache_5</artifactId>

agent/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>tank-parent</artifactId>
9-
<version>3.0.1</version>
9+
<version>3.0.2</version>
1010
</parent>
1111

1212
<artifactId>agent-parent</artifactId>

api/pom.xml

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

1212
<artifactId>api</artifactId>
@@ -75,5 +75,4 @@
7575
</dependency>
7676
</dependencies>
7777

78-
7978
</project>

api/src/main/java/com/intuit/tank/harness/AmazonUtil.java

+19-27
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,18 @@
1313
* #L%
1414
*/
1515

16-
import java.io.BufferedReader;
1716
import java.io.IOException;
18-
import java.io.InputStream;
19-
import java.io.InputStreamReader;
20-
import java.net.HttpURLConnection;
21-
import java.net.URL;
22-
import java.nio.charset.StandardCharsets;
17+
import java.net.URI;
18+
import java.net.http.HttpClient;
19+
import java.net.http.HttpRequest;
20+
import java.net.http.HttpResponse;
21+
import java.time.Duration;
2322
import java.util.Collections;
2423
import java.util.Map;
25-
import java.util.stream.Collectors;
2624

2725
import javax.annotation.Nonnull;
2826

29-
import com.google.common.base.Splitter;
27+
import com.fasterxml.jackson.databind.ObjectMapper;
3028
import com.google.common.collect.ImmutableMap;
3129
import org.apache.commons.lang3.StringUtils;
3230
import org.apache.logging.log4j.LogManager;
@@ -151,16 +149,6 @@ public static String getMetaData(CloudMetaDataType metaData) throws IOException
151149
return getResponseString(BASE + META_DATA + "/" + metaData.getKey());
152150
}
153151

154-
/**
155-
* Gets the user data associated with this instance.
156-
*
157-
* @return the user data as a Map
158-
* @throws IOException
159-
*/
160-
public static String getUserDataAsString() throws IOException {
161-
return getResponseString(BASE + USER_DATA);
162-
}
163-
164152
/**
165153
* gets the job id form user data
166154
*
@@ -246,9 +234,11 @@ public static Map<String, String> getUserDataAsMap() {
246234
try {
247235
String userData = getResponseString(BASE + USER_DATA);
248236
if (StringUtils.isNotEmpty(userData)) {
249-
return Splitter.on(System.getProperty("line.separator")).withKeyValueSeparator("=").split(userData);
237+
return (Map<String,String>) new ObjectMapper().readValue(userData, Map.class);
250238
}
251-
} catch (IllegalArgumentException | IOException e) { }
239+
} catch (IllegalArgumentException | IOException e) {
240+
LOG.warn(new ObjectMessage(ImmutableMap.of("Message","Unable to parse tank json: This is normal during the bake process")));
241+
}
252242
return Collections.emptyMap();
253243
}
254244

@@ -258,12 +248,14 @@ public static Map<String, String> getUserDataAsMap() {
258248
* @throws IOException
259249
*/
260250
private static String getResponseString(String url) throws IOException {
261-
HttpURLConnection con = (HttpURLConnection) new URL(url).openConnection();
262-
con.setRequestMethod("GET");
263-
con.setConnectTimeout(3000);
264-
InputStream is = con.getInputStream();
265-
return new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))
266-
.lines()
267-
.collect(Collectors.joining(System.getProperty("line.separator")));
251+
HttpClient client = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(3)).build();
252+
HttpRequest request = HttpRequest.newBuilder().uri(URI.create(url)).build();
253+
try {
254+
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
255+
if (response.statusCode() == 200) return response.body();
256+
} catch (InterruptedException e) {
257+
LOG.error(new ObjectMessage(ImmutableMap.of("Message","Unable to read userdata/metadata: " + e.getMessage())));
258+
}
259+
throw new IOException("Bad Response From AWS data");
268260
}
269261
}

api/src/main/java/com/intuit/tank/vm/common/PasswordEncoder.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* #L%
1717
*/
1818

19-
import org.apache.tomcat.util.codec.binary.Base64;
19+
import org.apache.commons.codec.binary.Base64;
2020

2121
import java.security.MessageDigest;
2222
import java.security.NoSuchAlgorithmException;

0 commit comments

Comments
 (0)