Skip to content

Commit

Permalink
Release 3.0.2
Browse files Browse the repository at this point in the history
* Primefaces 10.0.0
* remove prettyfaces
* Pass UserData as JSON
* AgentStartup java HttpClient
* CodeCoverage 36% -> 44%
* Library Updates
* yum tomcat9
  • Loading branch information
kevin-mcgoldrick authored Jun 30, 2021
1 parent d99c701 commit 67b21be
Show file tree
Hide file tree
Showing 139 changed files with 2,202 additions and 1,752 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ jdk:

env:
- SKIP_METHODTIMER_TEST=true
- SKIP_GUI_TEST=true

script: mvn clean install -P default,coverage
2 changes: 1 addition & 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>3.0.1</version>
<version>3.0.2</version>
</parent>

<artifactId>agent-common</artifactId>
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>3.0.1</version>
<version>3.0.2</version>
</parent>

<artifactId>agent-standalone</artifactId>
Expand Down
2 changes: 1 addition & 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>3.0.1</version>
<version>3.0.2</version>
</parent>

<artifactId>agent-standalone-pkg</artifactId>
Expand Down
6 changes: 1 addition & 5 deletions agent/agent_startup/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,20 @@
<parent>
<groupId>com.intuit.tank</groupId>
<artifactId>agent-parent</artifactId>
<version>3.0.1</version>
<version>3.0.2</version>
</parent>

<artifactId>agent-startup</artifactId>

<packaging>jar</packaging>
<name>Agent Startup</name>



<dependencies>

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

</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
import java.io.EOFException;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.net.ConnectException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.zip.ZipEntry;
import java.util.zip.ZipException;
import java.util.zip.ZipInputStream;
Expand All @@ -34,7 +33,7 @@
import software.amazon.awssdk.utils.StringUtils;

public class AgentStartup implements Runnable {
private static Logger logger = LogManager.getLogger(AgentStartup.class);
private static final Logger logger = LogManager.getLogger(AgentStartup.class);
private static final String SERVICE_RELATIVE_PATH = "/rest/v1/agent-service";
private static final String METHOD_SETTINGS = "/settings";
private static final String API_HARNESS_COMMAND = "./startAgent.sh";
Expand All @@ -54,14 +53,8 @@ public void run() {
URL url = new URL(controllerBaseUrl + SERVICE_RELATIVE_PATH + METHOD_SETTINGS);
logger.info("Starting up: making call to tank service url to get settings.xml "
+ url.toExternalForm());
try ( InputStream settingsStream = url.openStream() ) {
String settings = IOUtils.toString(settingsStream, StandardCharsets.UTF_8);
FileUtils.writeStringToFile(new File("settings.xml"), settings, StandardCharsets.UTF_8);
logger.info("got settings file...");
} catch (ConnectException ce) {
logger.error("Error creating connection to "
+ controllerBaseUrl + " : this is normal during the bake : " + ce.getMessage());
}
FileUtils.copyURLToFile(url, new File("settings.xml"));
logger.info("got settings file...");
// Download Support Files
url = new URL(controllerBaseUrl + SERVICE_RELATIVE_PATH + METHOD_SUPPORT);
logger.info("Making call to tank service url to get support files " + url.toExternalForm());
Expand Down Expand Up @@ -92,9 +85,12 @@ public void run() {
logger.info("Starting apiharness with command: "
+ API_HARNESS_COMMAND + " -http=" + controllerBaseUrl + " " + jvmArgs);
Runtime.getRuntime().exec(API_HARNESS_COMMAND + " -http=" + controllerBaseUrl + " " + jvmArgs);
} catch (Exception e) {
logger.error("Error in AgentStartup " + e, e);
}
} catch (ConnectException ce) {
logger.error("Error creating connection to "
+ controllerBaseUrl + " : this is normal during the bake : " + ce.getMessage());
} catch (IOException e) {
logger.error("Error Executing API Harness Command: " + API_HARNESS_COMMAND + ": " + e, e);
} catch (InterruptedException e) {}
}

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

}
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>3.0.1</version>
<version>3.0.2</version>
</parent>

<artifactId>agent-startup-pkg</artifactId>
Expand Down
2 changes: 1 addition & 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>3.0.1</version>
<version>3.0.2</version>
</parent>

<artifactId>agent</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion agent/apiharness_pkg/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.intuit.tank</groupId>
<artifactId>agent-parent</artifactId>
<version>3.0.1</version>
<version>3.0.2</version>
</parent>

<artifactId>apiharness</artifactId>
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>3.0.1</version>
<version>3.0.2</version>
</parent>

<artifactId>http_client_apache_3</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion agent/http_client_4/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>3.0.1</version>
<version>3.0.2</version>
</parent>

<artifactId>http_client_apache_4</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion agent/http_client_5/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>3.0.1</version>
<version>3.0.2</version>
</parent>

<artifactId>http_client_apache_5</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion agent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.intuit.tank</groupId>
<artifactId>tank-parent</artifactId>
<version>3.0.1</version>
<version>3.0.2</version>
</parent>

<artifactId>agent-parent</artifactId>
Expand Down
3 changes: 1 addition & 2 deletions api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.intuit.tank</groupId>
<artifactId>tank-parent</artifactId>
<version>3.0.1</version>
<version>3.0.2</version>
</parent>

<artifactId>api</artifactId>
Expand Down Expand Up @@ -75,5 +75,4 @@
</dependency>
</dependencies>


</project>
46 changes: 19 additions & 27 deletions api/src/main/java/com/intuit/tank/harness/AmazonUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,18 @@
* #L%
*/

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import java.util.Collections;
import java.util.Map;
import java.util.stream.Collectors;

import javax.annotation.Nonnull;

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

/**
* Gets the user data associated with this instance.
*
* @return the user data as a Map
* @throws IOException
*/
public static String getUserDataAsString() throws IOException {
return getResponseString(BASE + USER_DATA);
}

/**
* gets the job id form user data
*
Expand Down Expand Up @@ -246,9 +234,11 @@ public static Map<String, String> getUserDataAsMap() {
try {
String userData = getResponseString(BASE + USER_DATA);
if (StringUtils.isNotEmpty(userData)) {
return Splitter.on(System.getProperty("line.separator")).withKeyValueSeparator("=").split(userData);
return (Map<String,String>) new ObjectMapper().readValue(userData, Map.class);
}
} catch (IllegalArgumentException | IOException e) { }
} catch (IllegalArgumentException | IOException e) {
LOG.warn(new ObjectMessage(ImmutableMap.of("Message","Unable to parse tank json: This is normal during the bake process")));
}
return Collections.emptyMap();
}

Expand All @@ -258,12 +248,14 @@ public static Map<String, String> getUserDataAsMap() {
* @throws IOException
*/
private static String getResponseString(String url) throws IOException {
HttpURLConnection con = (HttpURLConnection) new URL(url).openConnection();
con.setRequestMethod("GET");
con.setConnectTimeout(3000);
InputStream is = con.getInputStream();
return new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))
.lines()
.collect(Collectors.joining(System.getProperty("line.separator")));
HttpClient client = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(3)).build();
HttpRequest request = HttpRequest.newBuilder().uri(URI.create(url)).build();
try {
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() == 200) return response.body();
} catch (InterruptedException e) {
LOG.error(new ObjectMessage(ImmutableMap.of("Message","Unable to read userdata/metadata: " + e.getMessage())));
}
throw new IOException("Bad Response From AWS data");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* #L%
*/

import org.apache.tomcat.util.codec.binary.Base64;
import org.apache.commons.codec.binary.Base64;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
Expand Down
Loading

0 comments on commit 67b21be

Please sign in to comment.