You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by st...@apache.org on 2019/03/05 10:40:41 UTC
[hadoop] branch branch-3.2 updated: HADOOP-16041. Include Hadoop
version in User-Agent string for ABFS.
This is an automated email from the ASF dual-hosted git repository.
stevel pushed a commit to branch branch-3.2
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/branch-3.2 by this push:
new ae832cc HADOOP-16041. Include Hadoop version in User-Agent string for ABFS.
ae832cc is described below
commit ae832ccffe05d79a4055b95af73ae15d8b8b13ae
Author: Da Zhou <da...@microsoft.com>
AuthorDate: Tue Mar 5 10:39:37 2019 +0000
HADOOP-16041. Include Hadoop version in User-Agent string for ABFS.
Contributed by Shweta Yakkali.
Signed-off-by: Sean Mackrory <ma...@apache.org>
(cherry picked from commit 02eb91856e7e8477c62e0f8bf1bac6de3e00a8a4)
Signed-off-by: Steve Loughran <st...@apache.org>
---
.../hadoop/fs/azurebfs/constants/AbfsHttpConstants.java | 3 ++-
.../hadoop/fs/azurebfs/services/TestAbfsClient.java | 16 ++++++++++++----
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/constants/AbfsHttpConstants.java b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/constants/AbfsHttpConstants.java
index ff66bf7..1f35854 100644
--- a/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/constants/AbfsHttpConstants.java
+++ b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/constants/AbfsHttpConstants.java
@@ -20,6 +20,7 @@ package org.apache.hadoop.fs.azurebfs.constants;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
+import org.apache.hadoop.util.VersionInfo;
/**
* Responsible to keep all constant keys used in abfs rest client here.
@@ -43,7 +44,7 @@ public final class AbfsHttpConstants {
public static final String OS_NAME = "os.name";
public static final String OS_VERSION = "os.version";
- public static final String CLIENT_VERSION = "Azure Blob FS/1.0";
+ public static final String CLIENT_VERSION = "Azure Blob FS/" + VersionInfo.getVersion();
// Abfs Http Verb
public static final String HTTP_METHOD_DELETE = "DELETE";
diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/TestAbfsClient.java b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/TestAbfsClient.java
index 6a92bb2b4..4200933 100644
--- a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/TestAbfsClient.java
+++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/TestAbfsClient.java
@@ -28,6 +28,7 @@ import org.apache.hadoop.fs.azurebfs.AbfsConfiguration;
import org.apache.hadoop.fs.azurebfs.utils.SSLSocketFactoryEx;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys;
+import org.apache.hadoop.util.VersionInfo;
/**
* Test useragent of abfs client.
@@ -49,12 +50,15 @@ public final class TestAbfsClient {
}
String userAgent = client.initializeUserAgent(config, sslProviderName);
Pattern pattern = Pattern.compile(expectedPattern);
- Assert.assertTrue(pattern.matcher(userAgent).matches());
+ Assert.assertTrue("Incorrect User Agent String",
+ pattern.matcher(userAgent).matches());
}
@Test
public void verifyUnknownUserAgent() throws Exception {
- String expectedUserAgentPattern = "Azure Blob FS\\/1.0 \\(JavaJRE ([^\\)]+)\\)";
+ String clientVersion = "Azure Blob FS/" + VersionInfo.getVersion();
+ String expectedUserAgentPattern = String.format(clientVersion
+ + " %s", "\\(JavaJRE ([^\\)]+)\\)");
final Configuration configuration = new Configuration();
configuration.unset(ConfigurationKeys.FS_AZURE_USER_AGENT_PREFIX_KEY);
AbfsConfiguration abfsConfiguration = new AbfsConfiguration(configuration, accountName);
@@ -64,7 +68,9 @@ public final class TestAbfsClient {
@Test
public void verifyUserAgent() throws Exception {
- String expectedUserAgentPattern = "Azure Blob FS\\/1.0 \\(JavaJRE ([^\\)]+)\\) Partner Service";
+ String clientVersion = "Azure Blob FS/" + VersionInfo.getVersion();
+ String expectedUserAgentPattern = String.format(clientVersion
+ + " %s", "\\(JavaJRE ([^\\)]+)\\) Partner Service");
final Configuration configuration = new Configuration();
configuration.set(ConfigurationKeys.FS_AZURE_USER_AGENT_PREFIX_KEY, "Partner Service");
AbfsConfiguration abfsConfiguration = new AbfsConfiguration(configuration, accountName);
@@ -74,7 +80,9 @@ public final class TestAbfsClient {
@Test
public void verifyUserAgentWithSSLProvider() throws Exception {
- String expectedUserAgentPattern = "Azure Blob FS\\/1.0 \\(JavaJRE ([^\\)]+) SunJSSE-1.8\\) Partner Service";
+ String clientVersion = "Azure Blob FS/" + VersionInfo.getVersion();
+ String expectedUserAgentPattern = String.format(clientVersion
+ + " %s", "\\(JavaJRE ([^\\)]+)\\) Partner Service");
final Configuration configuration = new Configuration();
configuration.set(ConfigurationKeys.FS_AZURE_USER_AGENT_PREFIX_KEY, "Partner Service");
configuration.set(ConfigurationKeys.FS_AZURE_SSL_CHANNEL_MODE_KEY,
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org