Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
AMBARI-23811. TimelineMetricsFilterTest fails if dir name contains @ …
…(#1237)
  • Loading branch information
adoroszlai committed May 10, 2018
1 parent 3d16f5d commit 056f69990ec5c0837cd6aee5abdf5ee6c48a2535
Showing 1 changed file with 9 additions and 8 deletions.
@@ -26,6 +26,7 @@
import org.easymock.EasyMock;
import org.junit.Test;

import java.net.URISyntaxException;
import java.net.URL;
import java.util.HashSet;
import java.util.Set;
@@ -64,9 +65,7 @@ public void testMetricWhitelisting() throws Exception {
expect(configuration.isWhitelistingEnabled()).andReturn(true).anyTimes();
replay(configuration);

URL fileUrl = ClassLoader.getSystemResource("test_data/metric_whitelist.dat");

metricsConf.set("timeline.metrics.whitelist.file", fileUrl.getPath());
metricsConf.set("timeline.metrics.whitelist.file", getTestWhitelistFilePath());
TimelineMetricsFilter.initializeMetricFilter(configuration);

TimelineMetric timelineMetric = new TimelineMetric();
@@ -93,8 +92,7 @@ public void testTogether() throws Exception {
expect(configuration.getMetricsConf()).andReturn(metricsConf).once();
replay(configuration);

URL fileUrl = ClassLoader.getSystemResource("test_data/metric_whitelist.dat");
metricsConf.set("timeline.metrics.whitelist.file", fileUrl.getPath());
metricsConf.set("timeline.metrics.whitelist.file", getTestWhitelistFilePath());

TimelineMetricsFilter.initializeMetricFilter(configuration);

@@ -161,11 +159,10 @@ public void testHybridFilter() throws Exception {
Configuration metricsConf = new Configuration();
metricsConf.set("timeline.metrics.apps.whitelist", "namenode,nimbus");
metricsConf.set("timeline.metrics.apps.blacklist", "datanode,kafka_broker");
URL fileUrl = ClassLoader.getSystemResource("test_data/metric_whitelist.dat");
metricsConf.set("timeline.metrics.whitelist.file", fileUrl.getPath());
metricsConf.set("timeline.metrics.whitelist.file", getTestWhitelistFilePath());
expect(configuration.getMetricsConf()).andReturn(metricsConf).once();

Set<String> whitelist = new HashSet();
Set<String> whitelist = new HashSet<>();
whitelist.add("regionserver.Server.Delete_99th_percentile");
whitelist.add("regionserver.Server.Delete_max");
whitelist.add("regionserver.Server.Delete_mean");
@@ -220,4 +217,8 @@ public void testHybridFilter() throws Exception {
timelineMetric.setAppId("hbase");
Assert.assertFalse(TimelineMetricsFilter.acceptMetric(timelineMetric));
}

private static String getTestWhitelistFilePath() throws URISyntaxException {
return ClassLoader.getSystemResource("test_data/metric_whitelist.dat").toURI().getPath();
}
}

0 comments on commit 056f699

Please sign in to comment.