@Test
public void testHBaseConfigClusterUpdatePropertiesFilterAuthorizationOff() throws Exception {

  // reset the stack mock, since we need more than the default behavior for this test
  reset(stack);
  final String expectedHostGroupName = "host_group_1";
  Map<String, Map<String, String>> properties = new HashMap<String, Map<String, String>>();
  Map<String, String> hbaseSiteProperties = new HashMap<String, String>();
  properties.put("hbase-site", hbaseSiteProperties);
  // setup properties for HBase to simulate the case of authorization being off
  hbaseSiteProperties.put("hbase.security.authorization", "false");
  hbaseSiteProperties.put("hbase.coprocessor.regionserver.classes", " ");
  hbaseSiteProperties.put("hbase.coprocessor.master.classes", "");
  Map<String, Stack.ConfigProperty> mapOfMetadata =
    new HashMap<String, Stack.ConfigProperty>();
  // simulate the stack dependencies for these Hive properties, that are dependent upon
  // hbase.security.authorization being enabled
  Stack.ConfigProperty configProperty1 =
    new Stack.ConfigProperty("hbase-site", "hbase.coprocessor.regionserver.classes", " ") {
      @Override
      Set<PropertyDependencyInfo> getDependsOnProperties() {
        PropertyDependencyInfo dependencyInfo = new PropertyDependencyInfo("hbase-site", "hbase.security.authorization");
        return Collections.singleton(dependencyInfo);
      }
    };
  Stack.ConfigProperty configProperty2 =
      new Stack.ConfigProperty("hbase-site", "hbase.coprocessor.master.classes", "") {
        @Override
        Set<PropertyDependencyInfo> getDependsOnProperties() {
          PropertyDependencyInfo dependencyInfo = new PropertyDependencyInfo("hbase-site", "hbase.security.authorization");
          return Collections.singleton(dependencyInfo);
        }
      };
  Stack.ConfigProperty configProperty3 =
      new Stack.ConfigProperty("hbase-site", "hbase.coprocessor.region.classes", "") {
        @Override
        Set<PropertyDependencyInfo> getDependsOnProperties() {
          PropertyDependencyInfo dependencyInfo = new PropertyDependencyInfo("hbase-site", "hbase.security.authorization");
          return Collections.singleton(dependencyInfo);
        }
      };
  mapOfMetadata.put("hbase.coprocessor.regionserver.classes", configProperty1);
  mapOfMetadata.put("hbase.coprocessor.master.classes", configProperty2);
  mapOfMetadata.put("hbase.coprocessor.region.classes", configProperty3);
  // defaults from init() method that we need
  expect(stack.getName()).andReturn("testStack").anyTimes();
  expect(stack.getVersion()).andReturn("1").anyTimes();
  expect(stack.isMasterComponent((String) anyObject())).andReturn(false).anyTimes();
  Set<String> emptySet = Collections.emptySet();
  expect(stack.getExcludedConfigurationTypes(anyObject(String.class))).andReturn(emptySet).anyTimes();
    // customized stack calls for this test only
  expect(stack.getServiceForConfigType("hbase-site")).andReturn("HBASE").atLeastOnce();
  expect(stack.getConfigurationPropertiesWithMetadata("HBASE", "hbase-site")).andReturn(mapOfMetadata).atLeastOnce();
  Configuration clusterConfig = new Configuration(properties, Collections.<String, Map<String, Map<String, String>>>emptyMap());
  Collection<String> hgComponents = new HashSet<String>();
  hgComponents.add("NAMENODE");
  List<String> hosts = new ArrayList<String>();
  hosts.add("some-hose");
  TestHostGroup group1 = new TestHostGroup(expectedHostGroupName, hgComponents, hosts);
  Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>();
  hostGroups.add(group1);
  ClusterTopology topology = createClusterTopology(bp, clusterConfig, hostGroups);
  BlueprintConfigurationProcessor updater = new BlueprintConfigurationProcessor(topology);
  // call top-level cluster config update method
  updater.doUpdateForClusterCreate();
  assertFalse("hbase.coprocessor.regionserver.classes should have been filtered out of configuration",
    hbaseSiteProperties.containsKey("hbase.coprocessor.regionserver.classes"));
  assertTrue("hbase.coprocessor.master.classes should not have been filtered out of configuration",
    hbaseSiteProperties.containsKey("hbase.coprocessor.master.classes"));
  assertTrue("hbase.coprocessor.region.classes should not have been filtered out of configuration",
    hbaseSiteProperties.containsKey("hbase.coprocessor.master.classes"));
}