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

amagyar pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git

commit a6dd77afacbbc348aaa0f6c3b2c666f40269f3fe
Author: Attila Magyar <amag...@hortonworks.com>
AuthorDate: Mon Mar 12 13:51:51 2018 +0100

    AMBARI-22755. Show OneFS JMX metrics on the UI (amagyar)
---
 .../server/controller/internal/ConfigBasedJmxHostProvider.java | 10 +++++-----
 .../controller/internal/StackDefinedPropertyProvider.java      |  6 +++---
 .../java/org/apache/ambari/server/state/alert/AmsSource.java   |  4 ++--
 .../org/apache/ambari/server/state/alert/MetricSource.java     |  4 ++--
 .../org/apache/ambari/server/state/alert/ServerSource.java     |  4 ++--
 .../server/state/alert/{MetricsUri.java => UriInfo.java}       |  6 +++---
 .../java/org/apache/ambari/server/state/alert/WebSource.java   |  4 ++--
 .../org/apache/ambari/server/state/stack/MetricDefinition.java |  6 +++---
 .../controller/internal/ConfigBasedJmxHostProviderTest.java    |  8 ++++----
 .../state/alert/{MetricsUriTest.java => UriInfoTest.java}      |  8 ++++----
 10 files changed, 30 insertions(+), 30 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProvider.java
index 17ac1fe..ff513c5 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProvider.java
@@ -30,17 +30,17 @@ import java.util.Set;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.controller.jmx.JMXHostProvider;
 import org.apache.ambari.server.state.ConfigHelper;
-import org.apache.ambari.server.state.alert.MetricsUri;
+import org.apache.ambari.server.state.alert.UriInfo;
 
 /**
  * I'm a special {@link JMXHostProvider} that resolves JMX URIs based on 
cluster configuration.
  */
 public class ConfigBasedJmxHostProvider implements JMXHostProvider {
-  private final Map<String, MetricsUri> overriddenJmxUris;
+  private final Map<String, UriInfo> overriddenJmxUris;
   private final JMXHostProvider defaultProvider;
   private final ConfigHelper configHelper;
 
-  public ConfigBasedJmxHostProvider(Map<String, MetricsUri> overriddenJmxUris, 
JMXHostProvider defaultProvider, ConfigHelper configHelper) {
+  public ConfigBasedJmxHostProvider(Map<String, UriInfo> overriddenJmxUris, 
JMXHostProvider defaultProvider, ConfigHelper configHelper) {
     this.overriddenJmxUris = overriddenJmxUris;
     this.defaultProvider = defaultProvider;
     this.configHelper = configHelper;
@@ -58,7 +58,7 @@ public class ConfigBasedJmxHostProvider implements 
JMXHostProvider {
       .orElseGet(() -> defaultProvider.getHostNames(clusterName, 
componentName));
   }
 
-  private URI resolve(MetricsUri uri, String clusterName) {
+  private URI resolve(UriInfo uri, String clusterName) {
     try {
       return uri.resolve(config(clusterName));
     } catch (AmbariException e) {
@@ -85,7 +85,7 @@ public class ConfigBasedJmxHostProvider implements 
JMXHostProvider {
     return defaultProvider.getJMXRpcMetricTag(clusterName, componentName, 
port);
   }
 
-  private Optional<MetricsUri> overridenJmxUri(String component) {
+  private Optional<UriInfo> overridenJmxUri(String component) {
     return Optional.ofNullable(overriddenJmxUris.get(component));
   }
 
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProvider.java
index 34936a9..99ad46f 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProvider.java
@@ -50,7 +50,7 @@ import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.ConfigHelper;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.StackId;
-import org.apache.ambari.server.state.alert.MetricsUri;
+import org.apache.ambari.server.state.alert.UriInfo;
 import org.apache.ambari.server.state.stack.Metric;
 import org.apache.ambari.server.state.stack.MetricDefinition;
 import org.slf4j.Logger;
@@ -158,7 +158,7 @@ public class StackDefinedPropertyProvider implements 
PropertyProvider {
 
     List<PropertyProvider> additional = new ArrayList<>();
     Map<String, String> overriddenHosts = new HashMap<>();
-    Map<String, MetricsUri> overriddenJmxUris = new HashMap<>();
+    Map<String, UriInfo> overriddenJmxUris = new HashMap<>();
 
     try {
       for (Resource r : resources) {
@@ -250,7 +250,7 @@ public class StackDefinedPropertyProvider implements 
PropertyProvider {
     return resources;
   }
 
-  private JMXHostProvider jmxHostProvider(Map<String, MetricsUri> 
overriddenJmxUris, JMXHostProvider defaultProvider, ConfigHelper configHelper) {
+  private JMXHostProvider jmxHostProvider(Map<String, UriInfo> 
overriddenJmxUris, JMXHostProvider defaultProvider, ConfigHelper configHelper) {
     return overriddenJmxUris.isEmpty() ? defaultProvider : new 
ConfigBasedJmxHostProvider(overriddenJmxUris, defaultProvider, configHelper);
   }
 
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AmsSource.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AmsSource.java
index 3a3ec2f..f739115 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AmsSource.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AmsSource.java
@@ -34,7 +34,7 @@ import com.google.gson.annotations.SerializedName;
 public class AmsSource extends Source {
 
   @SerializedName("uri")
-  private MetricsUri uri = null;
+  private UriInfo uri = null;
 
   @SerializedName("ams")
   private AmsInfo amsInfo = null;
@@ -51,7 +51,7 @@ public class AmsSource extends Source {
    * @return the uri info, which may include port information
    */
   @JsonProperty("uri")
-  public MetricsUri getUri() {
+  public UriInfo getUri() {
     return uri;
   }
 
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricSource.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricSource.java
index 8107383..ff7565e 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricSource.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricSource.java
@@ -43,7 +43,7 @@ import com.google.gson.annotations.SerializedName;
 public class MetricSource extends Source {
 
   @SerializedName("uri")
-  private MetricsUri uri = null;
+  private UriInfo uri = null;
 
   @SerializedName("jmx")
   private JmxInfo jmxInfo = null;
@@ -71,7 +71,7 @@ public class MetricSource extends Source {
    * @return the uri info, which may include port information
    */
   @JsonProperty("uri")
-  public MetricsUri getUri() {
+  public UriInfo getUri() {
     return uri;
   }
 
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/ServerSource.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/ServerSource.java
index 19e7ae6..642428e 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/ServerSource.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/ServerSource.java
@@ -34,7 +34,7 @@ public class ServerSource extends ParameterizedSource {
   private String m_class;
 
   @SerializedName("uri")
-  private MetricsUri uri = null;
+  private UriInfo uri = null;
 
   @SerializedName("jmx")
   private MetricSource.JmxInfo jmxInfo = null;
@@ -52,7 +52,7 @@ public class ServerSource extends ParameterizedSource {
     return jmxInfo;
   }
 
-  public MetricsUri getUri() {
+  public UriInfo getUri() {
     return uri;
   }
 
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricsUri.java
 b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/UriInfo.java
similarity index 98%
rename from 
ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricsUri.java
rename to 
ambari-server/src/main/java/org/apache/ambari/server/state/alert/UriInfo.java
index 0e52fd6..a2f1497 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricsUri.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/UriInfo.java
@@ -29,7 +29,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
 import com.google.gson.annotations.SerializedName;
 
 /**
- * The {@link MetricsUri} class is used to represent a complex URI structure 
where
+ * The {@link UriInfo} class is used to represent a complex URI structure where
  * there can be both a plaintext and SSL URI. This is used in cases where the
  * alert definition needs a way to expose which URL (http or https) should be
  * used to gather data. Currently, only {@link MetricSource} uses this, but it
@@ -37,7 +37,7 @@ import com.google.gson.annotations.SerializedName;
  * URI.
  */
 @JsonInclude(JsonInclude.Include.NON_EMPTY)
-public class MetricsUri {
+public class UriInfo {
   /**
    * The HTTP URI to use.
    */
@@ -374,7 +374,7 @@ public class MetricsUri {
       return false;
     }
 
-    MetricsUri other = (MetricsUri) obj;
+    UriInfo other = (UriInfo) obj;
     if (m_httpUri == null) {
       if (other.m_httpUri != null) {
         return false;
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/WebSource.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/WebSource.java
index 9accae3..16d8aad 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/WebSource.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/WebSource.java
@@ -33,13 +33,13 @@ import com.google.gson.annotations.SerializedName;
 public class WebSource extends Source {
 
   @SerializedName("uri")
-  private MetricsUri uri = null;
+  private UriInfo uri = null;
 
   /**
    * @return the uri info, which may include port information
    */
   @JsonProperty("uri")
-  public MetricsUri getUri() {
+  public UriInfo getUri() {
     return uri;
   }
 
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/MetricDefinition.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/MetricDefinition.java
index 08902d8..ed3c2a2 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/MetricDefinition.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/MetricDefinition.java
@@ -24,7 +24,7 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Optional;
 
-import org.apache.ambari.server.state.alert.MetricsUri;
+import org.apache.ambari.server.state.alert.UriInfo;
 import org.codehaus.jackson.annotate.JsonIgnore;
 import org.codehaus.jackson.annotate.JsonProperty;
 
@@ -39,7 +39,7 @@ public class MetricDefinition {
   private Map<String, String> properties = null;
   private Map<String, Map<String, Metric>> metrics = null;
   @SerializedName("jmx_source_uri")
-  private MetricsUri jmxSourceUri;
+  private UriInfo jmxSourceUri;
 
   public MetricDefinition(String type, Map<String, String> properties, 
Map<String, Map<String, Metric>> metrics) {
     this.type = type;
@@ -88,7 +88,7 @@ public class MetricDefinition {
       : Optional.ofNullable(properties.get(OVERRIDDEN_HOST_PROP));
   }
 
-  public Optional<MetricsUri> getJmxSourceUri() {
+  public Optional<UriInfo> getJmxSourceUri() {
     return !"jmx".equalsIgnoreCase(type) ? Optional.empty() : 
Optional.ofNullable(jmxSourceUri);
   }
 }
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProviderTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProviderTest.java
index ca4b4e4..3e86b63 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProviderTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigBasedJmxHostProviderTest.java
@@ -32,7 +32,7 @@ import java.util.Set;
 
 import org.apache.ambari.server.controller.jmx.JMXHostProvider;
 import org.apache.ambari.server.state.ConfigHelper;
-import org.apache.ambari.server.state.alert.MetricsUri;
+import org.apache.ambari.server.state.alert.UriInfo;
 import org.easymock.EasyMockRule;
 import org.easymock.EasyMockSupport;
 import org.easymock.Mock;
@@ -75,10 +75,10 @@ public class ConfigBasedJmxHostProviderTest extends 
EasyMockSupport {
     verifyAll();
   }
 
-  private Map<String, MetricsUri> overrideHosts() {
-    MetricsUri uri = new MetricsUri();
+  private Map<String, UriInfo> overrideHosts() {
+    UriInfo uri = new UriInfo();
     uri.setHttpUri("${hdfs-site/dfs.namenode.http-address}");
-    return new HashMap<String, MetricsUri>() {{
+    return new HashMap<String, UriInfo>() {{
       put(COMPONENT_WITH_OVERRIDDEN_HOST, uri);
     }};
   }
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/state/alert/MetricsUriTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/state/alert/UriInfoTest.java
similarity index 91%
rename from 
ambari-server/src/test/java/org/apache/ambari/server/state/alert/MetricsUriTest.java
rename to 
ambari-server/src/test/java/org/apache/ambari/server/state/alert/UriInfoTest.java
index 282103f..c37b2ca 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/state/alert/MetricsUriTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/state/alert/UriInfoTest.java
@@ -26,17 +26,17 @@ import java.util.Map;
 import org.apache.ambari.server.AmbariException;
 import org.junit.Test;
 
-public class MetricsUriTest {
+public class UriInfoTest {
   @Test
   public void testChoosesHttpByDefault() throws Exception {
-    MetricsUri uri = new MetricsUri();
+    UriInfo uri = new UriInfo();
     uri.setHttpUri("${config1/http-host}/path");
     assertThat(resolved(uri), is("http://http-host/path";));
   }
 
   @Test
   public void testChoosesHttpsBasedOnProperties() throws Exception {
-    MetricsUri uri = new MetricsUri();
+    UriInfo uri = new UriInfo();
     uri.setHttpUri("${config1/http-host}/path");
     uri.setHttpsUri("${config1/https-host}/path");
     uri.setHttpsProperty("${config1/use-http}");
@@ -54,7 +54,7 @@ public class MetricsUriTest {
       }};
   }
 
-  private String resolved(MetricsUri uri) throws AmbariException {
+  private String resolved(UriInfo uri) throws AmbariException {
     return uri.resolve(config()).toString();
   }
 }
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
amag...@apache.org.

Reply via email to