You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2019/06/12 14:27:30 UTC

[sling-whiteboard] 07/11: Rename 'Main' to 'HttpClientLauncher'

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git

commit 7e7dfe335c04af717fc28e702348f96143c34742
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Fri Jun 7 16:47:31 2019 +0200

    Rename 'Main' to 'HttpClientLauncher'
---
 .../src/test/java/org/apache/sling/uca/impl/AgentIT.java         | 8 ++++----
 .../apache/sling/uca/impl/{Main.java => HttpClientLauncher.java} | 9 ++++++---
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/url-connection-agent/src/test/java/org/apache/sling/uca/impl/AgentIT.java b/url-connection-agent/src/test/java/org/apache/sling/uca/impl/AgentIT.java
index 3a343ba..59240cd 100644
--- a/url-connection-agent/src/test/java/org/apache/sling/uca/impl/AgentIT.java
+++ b/url-connection-agent/src/test/java/org/apache/sling/uca/impl/AgentIT.java
@@ -34,7 +34,7 @@ import java.util.List;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.httpclient.ConnectTimeoutException;
-import org.apache.sling.uca.impl.Main.ClientType;
+import org.apache.sling.uca.impl.HttpClientLauncher.ClientType;
 import org.junit.jupiter.api.extension.ExtendWith;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.EnumSource;
@@ -71,7 +71,7 @@ public class AgentIT {
      * @throws IOException various I/O problems 
      */
     @ParameterizedTest
-    @EnumSource(Main.ClientType.class)
+    @EnumSource(HttpClientLauncher.ClientType.class)
     public void connectTimeout(ClientType clientType) throws IOException {
 
         RecordedThrowable error = assertTimeout(ofSeconds(5),  () -> runTest("http://repo1.maven.org:81", clientType));
@@ -107,7 +107,7 @@ public class AgentIT {
      * @throws IOException various I/O problems
      */
     @ParameterizedTest
-    @EnumSource(Main.ClientType.class)
+    @EnumSource(HttpClientLauncher.ClientType.class)
     public void readTimeout(ClientType clientType, MisbehavingServerControl server) throws IOException {
         
         RecordedThrowable error = assertTimeout(ofSeconds(5),  () -> runTest("http://localhost:" + server.getLocalPort(), clientType));
@@ -165,7 +165,7 @@ public class AgentIT {
             "-javaagent:" + jar +"=" + TimeUnit.SECONDS.toMillis(connectTimeoutSeconds) +"," + TimeUnit.SECONDS.toMillis(readTimeoutSeconds)+",v",
             "-cp",
             classPath,
-            "org.apache.sling.uca.impl.Main",
+            HttpClientLauncher.class.getName(),
             url.toString(),
             clientType.toString()
         );
diff --git a/url-connection-agent/src/test/java/org/apache/sling/uca/impl/Main.java b/url-connection-agent/src/test/java/org/apache/sling/uca/impl/HttpClientLauncher.java
similarity index 96%
rename from url-connection-agent/src/test/java/org/apache/sling/uca/impl/Main.java
rename to url-connection-agent/src/test/java/org/apache/sling/uca/impl/HttpClientLauncher.java
index aee0725..9d8ca73 100644
--- a/url-connection-agent/src/test/java/org/apache/sling/uca/impl/Main.java
+++ b/url-connection-agent/src/test/java/org/apache/sling/uca/impl/HttpClientLauncher.java
@@ -40,7 +40,10 @@ import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.util.EntityUtils;
 
-public class Main {
+/**
+ * CLI interface to run HTTP clients
+ */
+public class HttpClientLauncher {
     
     // TODO - write help messages with the values from this enum
     public enum ClientType {
@@ -50,7 +53,7 @@ public class Main {
     public static void main(String[] args) throws MalformedURLException, IOException {
         
         if ( args.length != 2 )
-            throw new IllegalArgumentException("Usage: java -cp ... " + Main.class.getName() + " <URL> JavaNet|HC3|HC4");
+            throw new IllegalArgumentException("Usage: java -cp ... " + HttpClientLauncher.class.getName() + " <URL> JavaNet|HC3|HC4");
         
         System.out.println(new Date() + " [WEB] Executing request via " + args[1]);
 
@@ -65,7 +68,7 @@ public class Main {
                 runUsingHttpClient4(args[0]);
                 break;
             default:
-                throw new IllegalArgumentException("Usage: java -cp ... " + Main.class.getName() + " <URL> JavaNet|HC3|HC4");
+                throw new IllegalArgumentException("Usage: java -cp ... " + HttpClientLauncher.class.getName() + " <URL> JavaNet|HC3|HC4");
         }
     }