eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From qingwz...@apache.org
Subject eagle git commit: [MINOR] Change default-rack to /default-rack
Date Wed, 25 Jan 2017 04:19:39 GMT
Repository: eagle
Updated Branches:
  refs/heads/master dbec60fc1 -> 031835c77


[MINOR] Change default-rack to /default-rack

- Change default-rack to /default-rack

Author: r7raul1984 <tangjijun@yhd.com>

Closes #787 from r7raul1984/DEFAULT-RACK.


Project: http://git-wip-us.apache.org/repos/asf/eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/eagle/commit/031835c7
Tree: http://git-wip-us.apache.org/repos/asf/eagle/tree/031835c7
Diff: http://git-wip-us.apache.org/repos/asf/eagle/diff/031835c7

Branch: refs/heads/master
Commit: 031835c772a87f1ca5228a409b21145caad79ff4
Parents: dbec60f
Author: r7raul1984 <tangjijun@yhd.com>
Authored: Wed Jan 25 12:19:32 2017 +0800
Committer: Zhao, Qingwen <qingwzhao@apache.org>
Committed: Wed Jan 25 12:19:32 2017 +0800

----------------------------------------------------------------------
 .../resolver/impl/ClusterNodeAPITopologyRackResolver.java      | 5 +++--
 .../eagle/topology/TestClusterNodeAPITopologyRackResolver.java | 6 +++---
 2 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/eagle/blob/031835c7/eagle-topology-check/eagle-topology-app/src/main/java/org/apache/eagle/topology/resolver/impl/ClusterNodeAPITopologyRackResolver.java
----------------------------------------------------------------------
diff --git a/eagle-topology-check/eagle-topology-app/src/main/java/org/apache/eagle/topology/resolver/impl/ClusterNodeAPITopologyRackResolver.java
b/eagle-topology-check/eagle-topology-app/src/main/java/org/apache/eagle/topology/resolver/impl/ClusterNodeAPITopologyRackResolver.java
index 0573b1d..a368d3d 100644
--- a/eagle-topology-check/eagle-topology-app/src/main/java/org/apache/eagle/topology/resolver/impl/ClusterNodeAPITopologyRackResolver.java
+++ b/eagle-topology-check/eagle-topology-app/src/main/java/org/apache/eagle/topology/resolver/impl/ClusterNodeAPITopologyRackResolver.java
@@ -19,6 +19,7 @@
 package org.apache.eagle.topology.resolver.impl;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.commons.lang.StringUtils;
 import org.apache.eagle.app.utils.AppConstants;
 import org.apache.eagle.app.utils.connection.InputStreamUtils;
 import org.apache.eagle.topology.TopologyCheckAppConfig;
@@ -36,7 +37,7 @@ import java.io.InputStream;
 public class ClusterNodeAPITopologyRackResolver implements TopologyRackResolver {
 
     private static final Logger LOG = LoggerFactory.getLogger(ClusterNodeAPITopologyRackResolver.class);
-    private static final String DEFAULT_RACK_NAME = "/default-rack";
+    private static final String DEFAULT_RACK_NAME = "default-rack";
     private String activeApiUrl = "";
     private String hostPort = "8041";//TODO configurable
     private static final ObjectMapper OBJ_MAPPER = new ObjectMapper();
@@ -56,7 +57,7 @@ public class ClusterNodeAPITopologyRackResolver implements TopologyRackResolver
             is = InputStreamUtils.getInputStream(requestUrl, null, AppConstants.CompressionType.NONE);
             LOG.info("resolve rack by api url {}", requestUrl);
             Node node = OBJ_MAPPER.readValue(is, Node.class);
-            rack = node.getNode().getRack();
+            rack = StringUtils.removeStart(node.getNode().getRack(),"/");
         } catch (Exception e) {
             LOG.warn("resolve rack by api url {} failed, {}", requestUrl, e);
             return rack;

http://git-wip-us.apache.org/repos/asf/eagle/blob/031835c7/eagle-topology-check/eagle-topology-app/src/test/java/org/apache/eagle/topology/TestClusterNodeAPITopologyRackResolver.java
----------------------------------------------------------------------
diff --git a/eagle-topology-check/eagle-topology-app/src/test/java/org/apache/eagle/topology/TestClusterNodeAPITopologyRackResolver.java
b/eagle-topology-check/eagle-topology-app/src/test/java/org/apache/eagle/topology/TestClusterNodeAPITopologyRackResolver.java
index 5090043..e34d971 100644
--- a/eagle-topology-check/eagle-topology-app/src/test/java/org/apache/eagle/topology/TestClusterNodeAPITopologyRackResolver.java
+++ b/eagle-topology-check/eagle-topology-app/src/test/java/org/apache/eagle/topology/TestClusterNodeAPITopologyRackResolver.java
@@ -38,7 +38,7 @@ import static org.powermock.api.mockito.PowerMockito.mockStatic;
 @RunWith(PowerMockRunner.class)
 @PrepareForTest(InputStreamUtils.class)
 public class TestClusterNodeAPITopologyRackResolver {
-    private static final String apiUrl = "http://yhd-jqhadoop168.int.yihaodian.com:8088/ws/v1/cluster/nodes";
+    private static final String apiUrl = "http://xxx-xxx.xxx.xxx.com:8088/ws/v1/cluster/nodes";
     private static final TopologyCheckAppConfig config = TopologyCheckAppConfig.newInstance(ConfigFactory.load().withFallback(
         ConfigFactory.parseMap(new HashMap<String, String>() {{
             put("topology.resolverAPIUrl", apiUrl);
@@ -53,7 +53,7 @@ public class TestClusterNodeAPITopologyRackResolver {
         Assert.assertTrue(resolverCls == ClusterNodeAPITopologyRackResolver.class);
         TopologyRackResolver topologyRackResolver = resolverCls.newInstance();
         topologyRackResolver.prepare(config);
-        Assert.assertEquals("/rowb/rack12", topologyRackResolver.resolve(hostname));
+        Assert.assertEquals("rowb/rack12", topologyRackResolver.resolve(hostname));
     }
 
     @Test
@@ -63,7 +63,7 @@ public class TestClusterNodeAPITopologyRackResolver {
         mockInputSteamWithException(apiUrl + "/" + hostname + ":8041");
         TopologyRackResolver topologyRackResolver = new ClusterNodeAPITopologyRackResolver();
         topologyRackResolver.prepare(config);
-        Assert.assertEquals("/default-rack", topologyRackResolver.resolve(hostname));
+        Assert.assertEquals("default-rack", topologyRackResolver.resolve(hostname));
     }
 
     private void mockInputSteam(String mockDataFilePath, String url) throws Exception {


Mime
View raw message