[02/50] [abbrv] ambari git commit: AMBARI-18601 : Analyze and Optimize Ambari Server Unit Tests - Group 4 (Commit 1) (avijayan)

2016-10-19 Thread ncole
AMBARI-18601 : Analyze and Optimize Ambari Server Unit Tests - Group 4 (Commit 
1) (avijayan)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9b9a2c07
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9b9a2c07
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9b9a2c07

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 9b9a2c07c7fa06f6575997b46583fc1dcafbfb08
Parents: 10c7595
Author: Aravindan Vijayan <avija...@hortonworks.com>
Authored: Fri Oct 14 11:28:22 2016 -0700
Committer: Aravindan Vijayan <avija...@hortonworks.com>
Committed: Fri Oct 14 11:28:22 2016 -0700

--
 .../timeline/AMSPropertyProviderTest.java   |  95 ++---
 .../ambari/server/state/ConfigHelperTest.java   | 139 ++-
 .../server/upgrade/UpgradeCatalog220Test.java   |  20 +--
 3 files changed, 156 insertions(+), 98 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/9b9a2c07/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
index 05fa880..251327f 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
@@ -40,6 +40,7 @@ import org.apache.ambari.server.controller.spi.TemporalInfo;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
 import org.apache.ambari.server.security.TestAuthenticationFactory;
 import org.apache.ambari.server.security.authorization.AuthorizationException;
+import 
org.apache.ambari.server.security.authorization.internal.InternalAuthenticationToken;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.ComponentInfo;
@@ -47,8 +48,11 @@ import org.apache.ambari.server.state.StackId;
 import org.apache.http.client.utils.URIBuilder;
 import org.easymock.EasyMock;
 import org.junit.After;
+import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Matchers;
@@ -112,75 +116,41 @@ public class AMSPropertyProviderTest {
   @Before
   public void setupCache() {
 cacheEntryFactory = new TimelineMetricCacheEntryFactory(new 
Configuration());
+InternalAuthenticationToken authenticationToken = new 
InternalAuthenticationToken("admin");
+authenticationToken.setAuthenticated(true);
+SecurityContextHolder.getContext().setAuthentication(authenticationToken);
   }
 
-  @After
-  public void clearAuthentication() {
-SecurityContextHolder.getContext().setAuthentication(null);
-  }
+  //SecurityContextHolder.getContext().setAuthentication(null);
 
   @Test
-  public void testAMSPropertyProviderAsClusterAdministrator() throws Exception 
{
-//Setup user with Role 'ClusterAdministrator'.
-
SecurityContextHolder.getContext().setAuthentication(TestAuthenticationFactory.createClusterAdministrator("ClusterAdmin",
 2L));
+  public void testRbacForAMSPropertyProvider() throws Exception {
 
+SecurityContextHolder.getContext().setAuthentication(null);
+//Cluster Administrator
+
SecurityContextHolder.getContext().setAuthentication(TestAuthenticationFactory.createClusterAdministrator("ClusterAdmin",
 2L));
 SecurityContextHolder.getContext();
 testPopulateResourcesForSingleHostMetric();
-testPopulateResourcesForSingleHostMetricPointInTime();
-testPopulateResourcesForMultipleHostMetricscPointInTime();
-testPopulateResourcesForMultipleHostMetrics();
-testPopulateResourcesForRegexpMetrics();
-testPopulateResourcesForSingleComponentMetric();
-testPopulateMetricsForEmbeddedHBase();
-testAggregateFunctionForComponentMetrics();
-testFilterOutOfBandMetricData();
-testPopulateResourcesForHostComponentHostMetrics();
-testPopulateResourcesForHostComponentMetricsForMultipleHosts();
-testPopulateResourcesHostBatches();
-testPopulateResourcesForMultipleComponentsMetric();
-  }
-
-  @Test
-  public void testAMSPropertyProviderAsAdministrator() throws Exception {
-//Setup user with Role 'Administrator'
-
SecurityContextHolder.getContext().setAuthentication(TestAuthenticationFactory.createAdministrator("Admin"

[02/30] ambari git commit: AMBARI-18601 : Analyze and Optimize Ambari Server Unit Tests - Group 4 (Commit 1) (avijayan)

2016-10-16 Thread jonathanhurley
AMBARI-18601 : Analyze and Optimize Ambari Server Unit Tests - Group 4 (Commit 
1) (avijayan)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9b9a2c07
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9b9a2c07
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9b9a2c07

Branch: refs/heads/branch-feature-AMBARI-18456
Commit: 9b9a2c07c7fa06f6575997b46583fc1dcafbfb08
Parents: 10c7595
Author: Aravindan Vijayan <avija...@hortonworks.com>
Authored: Fri Oct 14 11:28:22 2016 -0700
Committer: Aravindan Vijayan <avija...@hortonworks.com>
Committed: Fri Oct 14 11:28:22 2016 -0700

--
 .../timeline/AMSPropertyProviderTest.java   |  95 ++---
 .../ambari/server/state/ConfigHelperTest.java   | 139 ++-
 .../server/upgrade/UpgradeCatalog220Test.java   |  20 +--
 3 files changed, 156 insertions(+), 98 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/9b9a2c07/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
index 05fa880..251327f 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
@@ -40,6 +40,7 @@ import org.apache.ambari.server.controller.spi.TemporalInfo;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
 import org.apache.ambari.server.security.TestAuthenticationFactory;
 import org.apache.ambari.server.security.authorization.AuthorizationException;
+import 
org.apache.ambari.server.security.authorization.internal.InternalAuthenticationToken;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.ComponentInfo;
@@ -47,8 +48,11 @@ import org.apache.ambari.server.state.StackId;
 import org.apache.http.client.utils.URIBuilder;
 import org.easymock.EasyMock;
 import org.junit.After;
+import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Matchers;
@@ -112,75 +116,41 @@ public class AMSPropertyProviderTest {
   @Before
   public void setupCache() {
 cacheEntryFactory = new TimelineMetricCacheEntryFactory(new 
Configuration());
+InternalAuthenticationToken authenticationToken = new 
InternalAuthenticationToken("admin");
+authenticationToken.setAuthenticated(true);
+SecurityContextHolder.getContext().setAuthentication(authenticationToken);
   }
 
-  @After
-  public void clearAuthentication() {
-SecurityContextHolder.getContext().setAuthentication(null);
-  }
+  //SecurityContextHolder.getContext().setAuthentication(null);
 
   @Test
-  public void testAMSPropertyProviderAsClusterAdministrator() throws Exception 
{
-//Setup user with Role 'ClusterAdministrator'.
-
SecurityContextHolder.getContext().setAuthentication(TestAuthenticationFactory.createClusterAdministrator("ClusterAdmin",
 2L));
+  public void testRbacForAMSPropertyProvider() throws Exception {
 
+SecurityContextHolder.getContext().setAuthentication(null);
+//Cluster Administrator
+
SecurityContextHolder.getContext().setAuthentication(TestAuthenticationFactory.createClusterAdministrator("ClusterAdmin",
 2L));
 SecurityContextHolder.getContext();
 testPopulateResourcesForSingleHostMetric();
-testPopulateResourcesForSingleHostMetricPointInTime();
-testPopulateResourcesForMultipleHostMetricscPointInTime();
-testPopulateResourcesForMultipleHostMetrics();
-testPopulateResourcesForRegexpMetrics();
-testPopulateResourcesForSingleComponentMetric();
-testPopulateMetricsForEmbeddedHBase();
-testAggregateFunctionForComponentMetrics();
-testFilterOutOfBandMetricData();
-testPopulateResourcesForHostComponentHostMetrics();
-testPopulateResourcesForHostComponentMetricsForMultipleHosts();
-testPopulateResourcesHostBatches();
-testPopulateResourcesForMultipleComponentsMetric();
-  }
-
-  @Test
-  public void testAMSPropertyProviderAsAdministrator() throws Exception {
-//Setup user with Role 'Administrator'
-
SecurityContextHolder.getContext().setAuthentication(TestAuthenticationFactory.createAdministrator("Admin"

ambari git commit: AMBARI-18601 : Analyze and Optimize Ambari Server Unit Tests - Group 4 (Commit 1) (avijayan)

2016-10-14 Thread avijayan
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 86c2cda7e -> 724da0864


AMBARI-18601 : Analyze and Optimize Ambari Server Unit Tests - Group 4 (Commit 
1) (avijayan)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/724da086
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/724da086
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/724da086

Branch: refs/heads/branch-2.5
Commit: 724da086472793b580a3a228bab31979143a1aff
Parents: 86c2cda
Author: Aravindan Vijayan <avija...@hortonworks.com>
Authored: Fri Oct 14 11:30:54 2016 -0700
Committer: Aravindan Vijayan <avija...@hortonworks.com>
Committed: Fri Oct 14 11:30:54 2016 -0700

--
 .../timeline/AMSPropertyProviderTest.java   |  95 ++---
 .../ambari/server/state/ConfigHelperTest.java   | 139 ++-
 .../server/upgrade/UpgradeCatalog220Test.java   |  20 +--
 3 files changed, 156 insertions(+), 98 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/724da086/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
index 05fa880..251327f 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
@@ -40,6 +40,7 @@ import org.apache.ambari.server.controller.spi.TemporalInfo;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
 import org.apache.ambari.server.security.TestAuthenticationFactory;
 import org.apache.ambari.server.security.authorization.AuthorizationException;
+import 
org.apache.ambari.server.security.authorization.internal.InternalAuthenticationToken;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.ComponentInfo;
@@ -47,8 +48,11 @@ import org.apache.ambari.server.state.StackId;
 import org.apache.http.client.utils.URIBuilder;
 import org.easymock.EasyMock;
 import org.junit.After;
+import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Matchers;
@@ -112,75 +116,41 @@ public class AMSPropertyProviderTest {
   @Before
   public void setupCache() {
 cacheEntryFactory = new TimelineMetricCacheEntryFactory(new 
Configuration());
+InternalAuthenticationToken authenticationToken = new 
InternalAuthenticationToken("admin");
+authenticationToken.setAuthenticated(true);
+SecurityContextHolder.getContext().setAuthentication(authenticationToken);
   }
 
-  @After
-  public void clearAuthentication() {
-SecurityContextHolder.getContext().setAuthentication(null);
-  }
+  //SecurityContextHolder.getContext().setAuthentication(null);
 
   @Test
-  public void testAMSPropertyProviderAsClusterAdministrator() throws Exception 
{
-//Setup user with Role 'ClusterAdministrator'.
-
SecurityContextHolder.getContext().setAuthentication(TestAuthenticationFactory.createClusterAdministrator("ClusterAdmin",
 2L));
+  public void testRbacForAMSPropertyProvider() throws Exception {
 
+SecurityContextHolder.getContext().setAuthentication(null);
+//Cluster Administrator
+
SecurityContextHolder.getContext().setAuthentication(TestAuthenticationFactory.createClusterAdministrator("ClusterAdmin",
 2L));
 SecurityContextHolder.getContext();
 testPopulateResourcesForSingleHostMetric();
-testPopulateResourcesForSingleHostMetricPointInTime();
-testPopulateResourcesForMultipleHostMetricscPointInTime();
-testPopulateResourcesForMultipleHostMetrics();
-testPopulateResourcesForRegexpMetrics();
-testPopulateResourcesForSingleComponentMetric();
-testPopulateMetricsForEmbeddedHBase();
-testAggregateFunctionForComponentMetrics();
-testFilterOutOfBandMetricData();
-testPopulateResourcesForHostComponentHostMetrics();
-testPopulateResourcesForHostComponentMetricsForMultipleHosts();
-testPopulateResourcesHostBatches();
-testPopulateResourcesForMultipleComponentsMetric();
-  }
-
-  @Test
-  public void testAMSPropertyProviderAsAdministrator() throws Exception {
-//Setup user with Role 'Administrator'
-
SecurityContextHolder.getContext().setAuthentication(TestAut

ambari git commit: AMBARI-18601 : Analyze and Optimize Ambari Server Unit Tests - Group 4 (Commit 1) (avijayan)

2016-10-14 Thread avijayan
Repository: ambari
Updated Branches:
  refs/heads/trunk 10c7595a4 -> 9b9a2c07c


AMBARI-18601 : Analyze and Optimize Ambari Server Unit Tests - Group 4 (Commit 
1) (avijayan)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9b9a2c07
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9b9a2c07
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9b9a2c07

Branch: refs/heads/trunk
Commit: 9b9a2c07c7fa06f6575997b46583fc1dcafbfb08
Parents: 10c7595
Author: Aravindan Vijayan <avija...@hortonworks.com>
Authored: Fri Oct 14 11:28:22 2016 -0700
Committer: Aravindan Vijayan <avija...@hortonworks.com>
Committed: Fri Oct 14 11:28:22 2016 -0700

--
 .../timeline/AMSPropertyProviderTest.java   |  95 ++---
 .../ambari/server/state/ConfigHelperTest.java   | 139 ++-
 .../server/upgrade/UpgradeCatalog220Test.java   |  20 +--
 3 files changed, 156 insertions(+), 98 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/9b9a2c07/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
index 05fa880..251327f 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
@@ -40,6 +40,7 @@ import org.apache.ambari.server.controller.spi.TemporalInfo;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
 import org.apache.ambari.server.security.TestAuthenticationFactory;
 import org.apache.ambari.server.security.authorization.AuthorizationException;
+import 
org.apache.ambari.server.security.authorization.internal.InternalAuthenticationToken;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.ComponentInfo;
@@ -47,8 +48,11 @@ import org.apache.ambari.server.state.StackId;
 import org.apache.http.client.utils.URIBuilder;
 import org.easymock.EasyMock;
 import org.junit.After;
+import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Matchers;
@@ -112,75 +116,41 @@ public class AMSPropertyProviderTest {
   @Before
   public void setupCache() {
 cacheEntryFactory = new TimelineMetricCacheEntryFactory(new 
Configuration());
+InternalAuthenticationToken authenticationToken = new 
InternalAuthenticationToken("admin");
+authenticationToken.setAuthenticated(true);
+SecurityContextHolder.getContext().setAuthentication(authenticationToken);
   }
 
-  @After
-  public void clearAuthentication() {
-SecurityContextHolder.getContext().setAuthentication(null);
-  }
+  //SecurityContextHolder.getContext().setAuthentication(null);
 
   @Test
-  public void testAMSPropertyProviderAsClusterAdministrator() throws Exception 
{
-//Setup user with Role 'ClusterAdministrator'.
-
SecurityContextHolder.getContext().setAuthentication(TestAuthenticationFactory.createClusterAdministrator("ClusterAdmin",
 2L));
+  public void testRbacForAMSPropertyProvider() throws Exception {
 
+SecurityContextHolder.getContext().setAuthentication(null);
+//Cluster Administrator
+
SecurityContextHolder.getContext().setAuthentication(TestAuthenticationFactory.createClusterAdministrator("ClusterAdmin",
 2L));
 SecurityContextHolder.getContext();
 testPopulateResourcesForSingleHostMetric();
-testPopulateResourcesForSingleHostMetricPointInTime();
-testPopulateResourcesForMultipleHostMetricscPointInTime();
-testPopulateResourcesForMultipleHostMetrics();
-testPopulateResourcesForRegexpMetrics();
-testPopulateResourcesForSingleComponentMetric();
-testPopulateMetricsForEmbeddedHBase();
-testAggregateFunctionForComponentMetrics();
-testFilterOutOfBandMetricData();
-testPopulateResourcesForHostComponentHostMetrics();
-testPopulateResourcesForHostComponentMetricsForMultipleHosts();
-testPopulateResourcesHostBatches();
-testPopulateResourcesForMultipleComponentsMetric();
-  }
-
-  @Test
-  public void testAMSPropertyProviderAsAdministrator() throws Exception {
-//Setup user with Role 'Administrator'
-
SecurityContextHolder.getContext().setAuthentication(TestAut

ambari git commit: AMBARI-18601 : Analyze and Optimize Ambari Server Unit Tests - Group 4 (Commit 1) (avijayan)

2016-10-14 Thread avijayan
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 cb9db0aef -> 71cf8c252


AMBARI-18601 : Analyze and Optimize Ambari Server Unit Tests - Group 4 (Commit 
1) (avijayan)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/71cf8c25
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/71cf8c25
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/71cf8c25

Branch: refs/heads/branch-2.5
Commit: 71cf8c252db91400f54cda45de8edf5bfaa00b55
Parents: cb9db0a
Author: Aravindan Vijayan <avija...@hortonworks.com>
Authored: Fri Oct 14 10:45:50 2016 -0700
Committer: Aravindan Vijayan <avija...@hortonworks.com>
Committed: Fri Oct 14 10:45:50 2016 -0700

--
 .../timeline/AMSPropertyProviderTest.java   |  95 ++---
 .../ambari/server/state/ConfigHelperTest.java   | 139 ++-
 .../server/state/ServiceComponentTest.java  | 116 +---
 .../server/upgrade/UpgradeCatalog220Test.java   |  20 +--
 4 files changed, 223 insertions(+), 147 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/71cf8c25/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
index 05fa880..251327f 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProviderTest.java
@@ -40,6 +40,7 @@ import org.apache.ambari.server.controller.spi.TemporalInfo;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
 import org.apache.ambari.server.security.TestAuthenticationFactory;
 import org.apache.ambari.server.security.authorization.AuthorizationException;
+import 
org.apache.ambari.server.security.authorization.internal.InternalAuthenticationToken;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.ComponentInfo;
@@ -47,8 +48,11 @@ import org.apache.ambari.server.state.StackId;
 import org.apache.http.client.utils.URIBuilder;
 import org.easymock.EasyMock;
 import org.junit.After;
+import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Matchers;
@@ -112,75 +116,41 @@ public class AMSPropertyProviderTest {
   @Before
   public void setupCache() {
 cacheEntryFactory = new TimelineMetricCacheEntryFactory(new 
Configuration());
+InternalAuthenticationToken authenticationToken = new 
InternalAuthenticationToken("admin");
+authenticationToken.setAuthenticated(true);
+SecurityContextHolder.getContext().setAuthentication(authenticationToken);
   }
 
-  @After
-  public void clearAuthentication() {
-SecurityContextHolder.getContext().setAuthentication(null);
-  }
+  //SecurityContextHolder.getContext().setAuthentication(null);
 
   @Test
-  public void testAMSPropertyProviderAsClusterAdministrator() throws Exception 
{
-//Setup user with Role 'ClusterAdministrator'.
-
SecurityContextHolder.getContext().setAuthentication(TestAuthenticationFactory.createClusterAdministrator("ClusterAdmin",
 2L));
+  public void testRbacForAMSPropertyProvider() throws Exception {
 
+SecurityContextHolder.getContext().setAuthentication(null);
+//Cluster Administrator
+
SecurityContextHolder.getContext().setAuthentication(TestAuthenticationFactory.createClusterAdministrator("ClusterAdmin",
 2L));
 SecurityContextHolder.getContext();
 testPopulateResourcesForSingleHostMetric();
-testPopulateResourcesForSingleHostMetricPointInTime();
-testPopulateResourcesForMultipleHostMetricscPointInTime();
-testPopulateResourcesForMultipleHostMetrics();
-testPopulateResourcesForRegexpMetrics();
-testPopulateResourcesForSingleComponentMetric();
-testPopulateMetricsForEmbeddedHBase();
-testAggregateFunctionForComponentMetrics();
-testFilterOutOfBandMetricData();
-testPopulateResourcesForHostComponentHostMetrics();
-testPopulateResourcesForHostComponentMetricsForMultipleHosts();
-testPopulateResourcesHostBatches();
-testPopulateResourcesForMultipleComponentsMetric();
-  }
-
-  @Test
-  public void testAMSPropertyProviderAsAdministrator() throws Exception {
-//Setup user with Role 'Administrator'
-
Securit