Repository: ambari
Updated Branches:
  refs/heads/trunk c3150a465 -> 4240f8496


http://git-wip-us.apache.org/repos/asf/ambari/blob/4240f849/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java
index 6c466ba..193a5c2 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java
@@ -15,17 +15,15 @@
 
 package org.apache.ambari.server.ldap.domain;
 
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.Map;
 
-import javax.inject.Inject;
-
 import org.apache.commons.lang.builder.EqualsBuilder;
 import org.apache.commons.lang.builder.HashCodeBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.inject.assistedinject.Assisted;
-
 /**
  * This class is an immutable representation of all the LDAP related 
configurationMap entries.
  */
@@ -35,142 +33,145 @@ public class AmbariLdapConfiguration {
 
   private final Map<String, String> configurationMap;
 
-  private Object configValue(AmbariLdapConfigKeys ambariLdapConfigKeys) {
+  private Object configValue(AmbariLdapConfigurationKeys 
ambariLdapConfigurationKeys) {
     Object value = null;
-    if (configurationMap.containsKey(ambariLdapConfigKeys.key())) {
-      value = configurationMap.get(ambariLdapConfigKeys.key());
+    if (configurationMap.containsKey(ambariLdapConfigurationKeys.key())) {
+      value = configurationMap.get(ambariLdapConfigurationKeys.key());
     } else {
-      LOGGER.warn("Ldap configuration property [{}] hasn't been set", 
ambariLdapConfigKeys.key());
+      LOGGER.warn("Ldap configuration property [{}] hasn't been set", 
ambariLdapConfigurationKeys.key());
     }
     return value;
   }
 
-  public void setValueFor(AmbariLdapConfigKeys ambariLdapConfigKeys, String 
value) {
-    configurationMap.put(ambariLdapConfigKeys.key(), value);
+  public void setValueFor(AmbariLdapConfigurationKeys 
ambariLdapConfigurationKeys, String value) {
+    configurationMap.put(ambariLdapConfigurationKeys.key(), value);
   }
 
-  // intentionally package private, instances to be created through the factory
-  @Inject
-  AmbariLdapConfiguration(@Assisted Map<String, String> configuration) {
+  public AmbariLdapConfiguration(Map<String, String> configuration) {
     this.configurationMap = configuration;
   }
 
   public boolean ldapEnabled() {
-    return Boolean.valueOf((String) 
configValue(AmbariLdapConfigKeys.LDAP_ENABLED));
+    return Boolean.valueOf((String) 
configValue(AmbariLdapConfigurationKeys.LDAP_ENABLED));
   }
 
   public String serverHost() {
-    return (String) configValue(AmbariLdapConfigKeys.SERVER_HOST);
+    return (String) configValue(AmbariLdapConfigurationKeys.SERVER_HOST);
   }
 
   public int serverPort() {
-    return Integer.valueOf((String) 
configValue(AmbariLdapConfigKeys.SERVER_PORT));
+    return Integer.valueOf((String) 
configValue(AmbariLdapConfigurationKeys.SERVER_PORT));
   }
 
   public boolean useSSL() {
-    return Boolean.valueOf((String) configValue(AmbariLdapConfigKeys.USE_SSL));
+    return Boolean.valueOf((String) 
configValue(AmbariLdapConfigurationKeys.USE_SSL));
   }
 
   public String trustStore() {
-    return (String) configValue(AmbariLdapConfigKeys.TRUST_STORE);
+    return (String) configValue(AmbariLdapConfigurationKeys.TRUST_STORE);
   }
 
   public String trustStoreType() {
-    return (String) configValue(AmbariLdapConfigKeys.TRUST_STORE_TYPE);
+    return (String) configValue(AmbariLdapConfigurationKeys.TRUST_STORE_TYPE);
   }
 
   public String trustStorePath() {
-    return (String) configValue(AmbariLdapConfigKeys.TRUST_STORE_PATH);
+    return (String) configValue(AmbariLdapConfigurationKeys.TRUST_STORE_PATH);
   }
 
   public String trustStorePassword() {
-    return (String) configValue(AmbariLdapConfigKeys.TRUST_STORE_PASSWORD);
+    return (String) 
configValue(AmbariLdapConfigurationKeys.TRUST_STORE_PASSWORD);
   }
 
   public boolean anonymousBind() {
-    return Boolean.valueOf((String) 
configValue(AmbariLdapConfigKeys.ANONYMOUS_BIND));
+    return Boolean.valueOf((String) 
configValue(AmbariLdapConfigurationKeys.ANONYMOUS_BIND));
   }
 
   public String bindDn() {
-    return (String) configValue(AmbariLdapConfigKeys.BIND_DN);
+    return (String) configValue(AmbariLdapConfigurationKeys.BIND_DN);
   }
 
   public String bindPassword() {
-    return (String) configValue(AmbariLdapConfigKeys.BIND_PASSWORD);
+    return (String) configValue(AmbariLdapConfigurationKeys.BIND_PASSWORD);
   }
 
   public String attributeDetection() {
-    return (String) configValue(AmbariLdapConfigKeys.ATTR_DETECTION);
+    return (String) configValue(AmbariLdapConfigurationKeys.ATTR_DETECTION);
   }
 
   public String dnAttribute() {
-    return (String) configValue(AmbariLdapConfigKeys.DN_ATTRIBUTE);
+    return (String) configValue(AmbariLdapConfigurationKeys.DN_ATTRIBUTE);
   }
 
   public String userObjectClass() {
-    return (String) configValue(AmbariLdapConfigKeys.USER_OBJECT_CLASS);
+    return (String) configValue(AmbariLdapConfigurationKeys.USER_OBJECT_CLASS);
   }
 
   public String userNameAttribute() {
-    return (String) configValue(AmbariLdapConfigKeys.USER_NAME_ATTRIBUTE);
+    return (String) 
configValue(AmbariLdapConfigurationKeys.USER_NAME_ATTRIBUTE);
   }
 
   public String userSearchBase() {
-    return (String) configValue(AmbariLdapConfigKeys.USER_SEARCH_BASE);
+    return (String) configValue(AmbariLdapConfigurationKeys.USER_SEARCH_BASE);
   }
 
   public String groupObjectClass() {
-    return (String) configValue(AmbariLdapConfigKeys.GROUP_OBJECT_CLASS);
+    return (String) 
configValue(AmbariLdapConfigurationKeys.GROUP_OBJECT_CLASS);
   }
 
   public String groupNameAttribute() {
-    return (String) configValue(AmbariLdapConfigKeys.GROUP_NAME_ATTRIBUTE);
+    return (String) 
configValue(AmbariLdapConfigurationKeys.GROUP_NAME_ATTRIBUTE);
   }
 
   public String groupMemberAttribute() {
-    return (String) configValue(AmbariLdapConfigKeys.GROUP_MEMBER_ATTRIBUTE);
+    return (String) 
configValue(AmbariLdapConfigurationKeys.GROUP_MEMBER_ATTRIBUTE);
   }
 
   public String groupSearchBase() {
-    return (String) configValue(AmbariLdapConfigKeys.GROUP_SEARCH_BASE);
+    return (String) configValue(AmbariLdapConfigurationKeys.GROUP_SEARCH_BASE);
   }
 
   public String userSearchFilter() {
-    return (String) configValue(AmbariLdapConfigKeys.USER_SEARCH_FILTER);
+    return (String) 
configValue(AmbariLdapConfigurationKeys.USER_SEARCH_FILTER);
   }
 
   public String userMemberReplacePattern() {
-    return (String) 
configValue(AmbariLdapConfigKeys.USER_MEMBER_REPLACE_PATTERN);
+    return (String) 
configValue(AmbariLdapConfigurationKeys.USER_MEMBER_REPLACE_PATTERN);
   }
 
   public String userMemberFilter() {
-    return (String) configValue(AmbariLdapConfigKeys.USER_MEMBER_FILTER);
+    return (String) 
configValue(AmbariLdapConfigurationKeys.USER_MEMBER_FILTER);
   }
 
   public String groupSearchFilter() {
-    return (String) configValue(AmbariLdapConfigKeys.GROUP_SEARCH_FILTER);
+    return (String) 
configValue(AmbariLdapConfigurationKeys.GROUP_SEARCH_FILTER);
   }
 
   public String groupMemberReplacePattern() {
-    return (String) 
configValue(AmbariLdapConfigKeys.GROUP_MEMBER_REPLACE_PATTERN);
+    return (String) 
configValue(AmbariLdapConfigurationKeys.GROUP_MEMBER_REPLACE_PATTERN);
   }
 
   public String groupMemberFilter() {
-    return (String) configValue(AmbariLdapConfigKeys.GROUP_MEMBER_FILTER);
+    return (String) 
configValue(AmbariLdapConfigurationKeys.GROUP_MEMBER_FILTER);
   }
 
   public boolean forceLowerCaseUserNames() {
-    return Boolean.valueOf((String) 
configValue(AmbariLdapConfigKeys.FORCE_LOWERCASE_USERNAMES));
+    return Boolean.valueOf((String) 
configValue(AmbariLdapConfigurationKeys.FORCE_LOWERCASE_USERNAMES));
   }
 
   public boolean paginationEnabled() {
-    return Boolean.valueOf((String) 
configValue(AmbariLdapConfigKeys.PAGINATION_ENABLED));
+    return Boolean.valueOf((String) 
configValue(AmbariLdapConfigurationKeys.PAGINATION_ENABLED));
   }
 
   public String referralHandling() {
-    return (String) configValue(AmbariLdapConfigKeys.REFERRAL_HANDLING);
+    return (String) configValue(AmbariLdapConfigurationKeys.REFERRAL_HANDLING);
   }
 
+  public Map<String, String> toMap() {
+    return (configurationMap == null)
+        ? Collections.emptyMap()
+        : new HashMap<>(configurationMap);
+  }
 
   @Override
   public String toString() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/4240f849/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfigurationFactory.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfigurationFactory.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfigurationFactory.java
deleted file mode 100644
index aafd204..0000000
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfigurationFactory.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ambari.server.ldap.domain;
-
-import java.util.Map;
-
-/**
- * Factory interface for AmbariLdapConfiguration instances.
- * It's registered as a factory in the GUICE context (so no implementations 
required)
- *
- * To be extended with other factory methods upon needs.
- */
-public interface AmbariLdapConfigurationFactory {
-
-  /**
-   * Creates an AmbariLdapConfiguration instance with the provided map of 
configuration settings.
-   *
-   * @param configuration a map where keys are the configuration properties 
and values are the configuration values
-   * @return an AmbariLdapConfiguration instance
-   */
-  AmbariLdapConfiguration createLdapConfiguration(Map<String, String> 
configuration);
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/4240f849/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfigurationKeys.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfigurationKeys.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfigurationKeys.java
new file mode 100644
index 0000000..2e1c36b
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfigurationKeys.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.server.ldap.domain;
+
+/**
+ * Constants representing supported LDAP related property names
+ * // todo extend this with validation information, description, defaults maybe
+ */
+public enum AmbariLdapConfigurationKeys {
+
+  LDAP_ENABLED("ambari.ldap.authentication.enabled"),
+  SERVER_HOST("ambari.ldap.connectivity.server.host"),
+  SERVER_PORT("ambari.ldap.connectivity.server.port"),
+  USE_SSL("ambari.ldap.connectivity.use_ssl"),
+
+  TRUST_STORE("ambari.ldap.connectivity.trust_store"),
+  TRUST_STORE_TYPE("ambari.ldap.connectivity.trust_store.type"),
+  TRUST_STORE_PATH("ambari.ldap.connectivity.trust_store.path"),
+  TRUST_STORE_PASSWORD("ambari.ldap.connectivity.trust_store.password"),
+  ANONYMOUS_BIND("ambari.ldap.connectivity.anonymous_bind"),
+
+  BIND_DN("ambari.ldap.connectivity.bind_dn"),
+  BIND_PASSWORD("ambari.ldap.connectivity.bind_password"),
+
+  ATTR_DETECTION("ambari.ldap.attributes.detection"), // manual | auto
+
+  DN_ATTRIBUTE("ambari.ldap.attributes.dn_attr"),
+
+  USER_OBJECT_CLASS("ambari.ldap.attributes.user.object_class"),
+  USER_NAME_ATTRIBUTE("ambari.ldap.attributes.user.name_attr"),
+  USER_GROUP_MEMBER_ATTRIBUTE("ambari.ldap.attributes.user.group_member_attr"),
+  USER_SEARCH_BASE("ambari.ldap.attributes.user.search_base"),
+
+  GROUP_OBJECT_CLASS("ambari.ldap.attributes.group.object_class"),
+  GROUP_NAME_ATTRIBUTE("ambari.ldap.attributes.group.name_attr"),
+  GROUP_MEMBER_ATTRIBUTE("ambari.ldap.attributes.group.member_attr"),
+  GROUP_SEARCH_BASE("ambari.ldap.attributes.group.search_base"),
+
+  USER_SEARCH_FILTER("ambari.ldap.advanced.user_search_filter"),
+  
USER_MEMBER_REPLACE_PATTERN("ambari.ldap.advanced.user_member_replace_pattern"),
+  USER_MEMBER_FILTER("ambari.ldap.advanced.user_member_filter"),
+
+  GROUP_SEARCH_FILTER("ambari.ldap.advanced.group_search_filter"),
+  
GROUP_MEMBER_REPLACE_PATTERN("ambari.ldap.advanced.group_member_replace_pattern"),
+  GROUP_MEMBER_FILTER("ambari.ldap.advanced.group_member_filter"),
+
+  FORCE_LOWERCASE_USERNAMES("ambari.ldap.advanced.force_lowercase_usernames"),
+  REFERRAL_HANDLING("ambari.ldap.advanced.referrals"), // folow
+  PAGINATION_ENABLED("ambari.ldap.advanced.pagination_enabled"); // true | 
false
+
+  private String propertyName;
+
+  AmbariLdapConfigurationKeys(String propName) {
+    this.propertyName = propName;
+  }
+
+  public String key() {
+    return this.propertyName;
+  }
+
+  public static AmbariLdapConfigurationKeys fromKeyStr(String keyStr) {
+    for (AmbariLdapConfigurationKeys key : values()) {
+      if (key.key().equals(keyStr)) {
+        return key;
+      }
+    }
+
+    throw new IllegalStateException("invalid konfiguration key found!");
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/4240f849/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java
index ac9c1bc..f1e1881 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java
@@ -1,7 +1,11 @@
 /*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
  *
  *     http://www.apache.org/licenses/LICENSE-2.0
  *
@@ -18,10 +22,10 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import 
org.apache.ambari.server.controller.internal.AmbariServerConfigurationCategory;
 import org.apache.ambari.server.events.AmbariConfigurationChangedEvent;
 import org.apache.ambari.server.events.publishers.AmbariEventPublisher;
 import org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration;
-import org.apache.ambari.server.ldap.domain.AmbariLdapConfigurationFactory;
 import org.apache.ambari.server.orm.dao.AmbariConfigurationDAO;
 import org.apache.ambari.server.orm.entities.AmbariConfigurationEntity;
 import 
org.apache.ambari.server.security.authorization.AmbariLdapAuthenticationProvider;
@@ -56,9 +60,6 @@ public class AmbariLdapConfigurationProvider implements 
Provider<AmbariLdapConfi
   private Provider<AmbariConfigurationDAO> ambariConfigurationDAOProvider;
 
   @Inject
-  private AmbariLdapConfigurationFactory ldapConfigurationFactory;
-
-  @Inject
   public AmbariLdapConfigurationProvider() {
   }
 
@@ -81,11 +82,11 @@ public class AmbariLdapConfigurationProvider implements 
Provider<AmbariLdapConfi
     List<AmbariConfigurationEntity> configEntities;
 
     LOGGER.info("Loading LDAP configuration ...");
-    configEntities = 
ambariConfigurationDAOProvider.get().findByCategory("ldap-configuration");
+    configEntities = 
ambariConfigurationDAOProvider.get().findByCategory(AmbariServerConfigurationCategory.LDAP_CONFIGURATION.getCategoryName());
 
     if (configEntities != null) {
       Map<String, String> properties = toProperties(configEntities);
-      instance = ldapConfigurationFactory.createLdapConfiguration(properties);
+      instance = new AmbariLdapConfiguration(properties);
     }
 
     LOGGER.info("Loaded LDAP configuration instance: [ {} ]", instance);

http://git-wip-us.apache.org/repos/asf/ambari/blob/4240f849/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
index 0118840..a9fd59b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
@@ -114,9 +114,7 @@ public class AmbariLdapFacade implements LdapFacade {
 
     // todo handle the case where group membership is stored in the user 
rather than the group
     LOGGER.info("Testing LDAP group attributes with test user dn: {}", userDn);
-    Set<String> groups = ldapConfigurationService.checkGroupAttributes(userDn, 
ldapConfiguration);
-
-    return groups;
+    return ldapConfigurationService.checkGroupAttributes(userDn, 
ldapConfiguration);
   }
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/4240f849/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapFacade.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapFacade.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapFacade.java
index ef84d1b..fc7ef98 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapFacade.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapFacade.java
@@ -22,7 +22,7 @@ import 
org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration;
 /**
  * The contract defining all the operations required by the application when 
communicating with an arbitrary LDAP server.
  * This interface is intended to decouple LDAP specific details from the 
application.
- *
+ * <p>
  * Any operation that requires interaction with an LDAP server from within 
Ambari should go through this interface.
  * (LDAP)
  */
@@ -39,11 +39,11 @@ public interface LdapFacade {
 
   /**
    * Runs the user and group attribute detection algorithms.
-   * The method is not intended to be used as a coniguration factory, the 
returned instance may not be suitable for use.
+   * The method is not intended to be used as a configuration factory, the 
returned instance may not be suitable for use.
    *
    * @param ambariLdapConfiguration partially filled configuration instance to 
be extended with detected properties
    * @return a configuration instance, with properties filled with potentially 
correct values
-   * @throws AmbariLdapException
+   * @throws AmbariLdapException if the attribute detection fails
    */
   AmbariLdapConfiguration detectAttributes(AmbariLdapConfiguration 
ambariLdapConfiguration) throws AmbariLdapException;
 
@@ -51,7 +51,8 @@ public interface LdapFacade {
    * Checks user and group related LDAP configuration attributes in the 
configuration object with the help of the provided parameters
    *
    * @param parameters              a map of property name and value pairs 
holding information to facilitate checking the attributes
-   * @param ambariLdapConfiguration configutration instance with available 
attributes
+   * @param ambariLdapConfiguration configuration instance with available 
attributes
+   * @return the set of groups assigned to the test user
    * @throws AmbariLdapException if the attribute checking fails
    */
   Set<String> checkLdapAttributes(Map<String, Object> parameters, 
AmbariLdapConfiguration ambariLdapConfiguration) throws AmbariLdapException;

http://git-wip-us.apache.org/repos/asf/ambari/blob/4240f849/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionService.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionService.java
index a9a9b53..23254c9 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionService.java
@@ -20,8 +20,8 @@ import java.util.Map;
 import javax.inject.Inject;
 import javax.inject.Singleton;
 
-import org.apache.ambari.server.ldap.domain.AmbariLdapConfigKeys;
 import org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration;
+import org.apache.ambari.server.ldap.domain.AmbariLdapConfigurationKeys;
 import org.apache.ambari.server.ldap.service.AmbariLdapException;
 import org.apache.ambari.server.ldap.service.AttributeDetector;
 import org.apache.ambari.server.ldap.service.LdapAttributeDetectionService;
@@ -154,7 +154,7 @@ public class DefaultLdapAttributeDetectionService 
implements LdapAttributeDetect
 
     for (Map.Entry<String, String> detecteMapEntry : 
detectedAttributes.entrySet()) {
       LOG.info("Setting detected configuration value: [{}] - > [{}]", 
detecteMapEntry.getKey(), detecteMapEntry.getValue());
-      
ambariLdapConfiguration.setValueFor(AmbariLdapConfigKeys.fromKeyStr(detecteMapEntry.getKey()),
 detecteMapEntry.getValue());
+      
ambariLdapConfiguration.setValueFor(AmbariLdapConfigurationKeys.fromKeyStr(detecteMapEntry.getKey()),
 detecteMapEntry.getValue());
     }
 
   }
@@ -163,7 +163,7 @@ public class DefaultLdapAttributeDetectionService 
implements LdapAttributeDetect
     try {
 
       SearchRequest req = 
ldapConnectionTemplate.newSearchRequest(ambariLdapConfiguration.userSearchBase(),
-        
FilterBuilder.present(ambariLdapConfiguration.dnAttribute()).toString(), 
SearchScope.SUBTREE);
+        FilterBuilder.present("objectClass").toString(), SearchScope.SUBTREE);
       req.setSizeLimit(SAMPLE_RESULT_SIZE);
 
       return req;
@@ -178,7 +178,7 @@ public class DefaultLdapAttributeDetectionService 
implements LdapAttributeDetect
     try {
 
       SearchRequest req = 
ldapConnectionTemplate.newSearchRequest(ambariLdapConfiguration.groupSearchBase(),
-        
FilterBuilder.present(ambariLdapConfiguration.dnAttribute()).toString(), 
SearchScope.SUBTREE);
+        FilterBuilder.present("objectClass").toString(), SearchScope.SUBTREE);
       req.setSizeLimit(SAMPLE_RESULT_SIZE);
 
       return req;

http://git-wip-us.apache.org/repos/asf/ambari/blob/4240f849/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConfigurationService.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConfigurationService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConfigurationService.java
index 3f6995c..cffb190 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConfigurationService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConfigurationService.java
@@ -106,8 +106,8 @@ public class DefaultLdapConfigurationService implements 
LdapConfigurationService
       userDn = 
ldapConnectionTemplateFactory.create(ambariLdapConfiguration).searchFirst(new 
Dn(ambariLdapConfiguration.userSearchBase()), filter, SearchScope.SUBTREE, 
getUserDnNameEntryMapper(ambariLdapConfiguration));
 
       if (null == userDn) {
-        LOGGER.info("Could not find user based on the provided configuration. 
User attributes are not complete ");
-        throw new AmbariLdapException("User attribute configuration 
incomplete");
+        LOGGER.info("Could not find test user based on the provided 
configuration. User attributes may not be complete or the user may not exist.");
+        throw new AmbariLdapException("Could not find test user based on the 
provided configuration. User attributes may not be complete or the user may not 
exist.");
       }
       LOGGER.info("Attribute validation succeeded. Filter: [{}]", filter);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/4240f849/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/GroupMemberAttrDetector.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/GroupMemberAttrDetector.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/GroupMemberAttrDetector.java
index 8c34ef8..191c8ee 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/GroupMemberAttrDetector.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/GroupMemberAttrDetector.java
@@ -16,7 +16,7 @@ package org.apache.ambari.server.ldap.service.ads.detectors;
 
 import javax.inject.Inject;
 
-import org.apache.ambari.server.ldap.domain.AmbariLdapConfigKeys;
+import org.apache.ambari.server.ldap.domain.AmbariLdapConfigurationKeys;
 import org.apache.directory.api.ldap.model.entry.Entry;
 
 public class GroupMemberAttrDetector extends OccurrenceAndWeightBasedDetector {
@@ -60,6 +60,6 @@ public class GroupMemberAttrDetector extends 
OccurrenceAndWeightBasedDetector {
 
   @Override
   public String detectedProperty() {
-    return AmbariLdapConfigKeys.GROUP_MEMBER_ATTRIBUTE.key();
+    return AmbariLdapConfigurationKeys.GROUP_MEMBER_ATTRIBUTE.key();
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/4240f849/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/GroupNameAttrDetector.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/GroupNameAttrDetector.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/GroupNameAttrDetector.java
index 0315ef2..4bd429a 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/GroupNameAttrDetector.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/GroupNameAttrDetector.java
@@ -16,18 +16,17 @@ package org.apache.ambari.server.ldap.service.ads.detectors;
 
 import javax.inject.Inject;
 
-import org.apache.ambari.server.ldap.domain.AmbariLdapConfigKeys;
+import org.apache.ambari.server.ldap.domain.AmbariLdapConfigurationKeys;
 import org.apache.directory.api.ldap.model.entry.Entry;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class GroupNameAttrDetector extends OccurrenceAndWeightBasedDetector {
-  private static final Logger LOGGER = 
LoggerFactory.getLogger(UserNameAttrDetector.class);
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(GroupNameAttrDetector.class);
 
   private enum GroupNameAttr {
 
     DISTINGUISHED_NAME("distinguishedName", 1),
-
     CN("cn", 1);
 
     private String attrName;
@@ -65,6 +64,6 @@ public class GroupNameAttrDetector extends 
OccurrenceAndWeightBasedDetector {
 
   @Override
   public String detectedProperty() {
-    return AmbariLdapConfigKeys.GROUP_NAME_ATTRIBUTE.key();
+    return AmbariLdapConfigurationKeys.GROUP_NAME_ATTRIBUTE.key();
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/4240f849/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/GroupObjectClassDetector.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/GroupObjectClassDetector.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/GroupObjectClassDetector.java
index b681134..407c1b0 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/GroupObjectClassDetector.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/GroupObjectClassDetector.java
@@ -16,7 +16,7 @@ package org.apache.ambari.server.ldap.service.ads.detectors;
 
 import javax.inject.Inject;
 
-import org.apache.ambari.server.ldap.domain.AmbariLdapConfigKeys;
+import org.apache.ambari.server.ldap.domain.AmbariLdapConfigurationKeys;
 import org.apache.directory.api.ldap.model.entry.Entry;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -26,13 +26,9 @@ public class GroupObjectClassDetector extends 
OccurrenceAndWeightBasedDetector {
   private static final Logger LOGGER = 
LoggerFactory.getLogger(GroupObjectClassDetector.class);
 
   private enum ObjectClassValue {
-
     GROUP("group", 1),
-
     GROUP_OF_NAMES("groupOfNames", 1),
-
     POSIX_GROUP("posixGroup", 1),
-
     GROUP_OF_UNIQUE_NAMES("groupOfUniqueNames", 1);
 
     private String ocVal;
@@ -68,6 +64,6 @@ public class GroupObjectClassDetector extends 
OccurrenceAndWeightBasedDetector {
 
   @Override
   public String detectedProperty() {
-    return AmbariLdapConfigKeys.GROUP_OBJECT_CLASS.key();
+    return AmbariLdapConfigurationKeys.GROUP_OBJECT_CLASS.key();
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/4240f849/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/UserGroupMemberAttrDetector.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/UserGroupMemberAttrDetector.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/UserGroupMemberAttrDetector.java
index b34a2b2..c785483 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/UserGroupMemberAttrDetector.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/UserGroupMemberAttrDetector.java
@@ -16,13 +16,12 @@ package org.apache.ambari.server.ldap.service.ads.detectors;
 
 import javax.inject.Inject;
 
-import org.apache.ambari.server.ldap.domain.AmbariLdapConfigKeys;
+import org.apache.ambari.server.ldap.domain.AmbariLdapConfigurationKeys;
 import org.apache.directory.api.ldap.model.entry.Entry;
 
 public class UserGroupMemberAttrDetector extends 
OccurrenceAndWeightBasedDetector {
 
   private enum UserGroupMemberAttr {
-
     MEMBER_OF("memberOf", 1),
     IS_MEMBER_OF("ismemberOf", 1);
 
@@ -59,6 +58,6 @@ public class UserGroupMemberAttrDetector extends 
OccurrenceAndWeightBasedDetecto
 
   @Override
   public String detectedProperty() {
-    return AmbariLdapConfigKeys.USER_GROUP_MEMBER_ATTRIBUTE.key();
+    return AmbariLdapConfigurationKeys.USER_GROUP_MEMBER_ATTRIBUTE.key();
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/4240f849/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/UserNameAttrDetector.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/UserNameAttrDetector.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/UserNameAttrDetector.java
index dec4459..aee0b3a 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/UserNameAttrDetector.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/UserNameAttrDetector.java
@@ -17,7 +17,7 @@ package org.apache.ambari.server.ldap.service.ads.detectors;
 import javax.inject.Inject;
 import javax.inject.Singleton;
 
-import org.apache.ambari.server.ldap.domain.AmbariLdapConfigKeys;
+import org.apache.ambari.server.ldap.domain.AmbariLdapConfigurationKeys;
 import org.apache.directory.api.ldap.model.entry.Entry;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -65,7 +65,7 @@ public class UserNameAttrDetector extends 
OccurrenceAndWeightBasedDetector {
 
   @Override
   public String detectedProperty() {
-    return AmbariLdapConfigKeys.USER_NAME_ATTRIBUTE.key();
+    return AmbariLdapConfigurationKeys.USER_NAME_ATTRIBUTE.key();
   }
 
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/4240f849/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/UserObjectClassDetector.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/UserObjectClassDetector.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/UserObjectClassDetector.java
index bf2f5b8..bb9fa1e 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/UserObjectClassDetector.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/UserObjectClassDetector.java
@@ -16,7 +16,7 @@ package org.apache.ambari.server.ldap.service.ads.detectors;
 
 import javax.inject.Inject;
 
-import org.apache.ambari.server.ldap.domain.AmbariLdapConfigKeys;
+import org.apache.ambari.server.ldap.domain.AmbariLdapConfigurationKeys;
 import org.apache.directory.api.ldap.model.entry.Entry;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -63,7 +63,7 @@ public class UserObjectClassDetector extends 
OccurrenceAndWeightBasedDetector {
 
   @Override
   public String detectedProperty() {
-    return AmbariLdapConfigKeys.USER_OBJECT_CLASS.key();
+    return AmbariLdapConfigurationKeys.USER_OBJECT_CLASS.key();
   }
 
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/4240f849/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommandTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommandTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommandTest.java
index 2afbf8a..99cd80e 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommandTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommandTest.java
@@ -18,7 +18,6 @@
 
 package org.apache.ambari.server.api.services.stackadvisor.commands;
 
-import static 
org.apache.ambari.server.api.services.stackadvisor.commands.StackAdvisorCommand.LDAP_CONFIGURATION_PROPERTY;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
@@ -56,6 +55,7 @@ import 
org.apache.ambari.server.api.services.stackadvisor.StackAdvisorRequestExc
 import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorResponse;
 import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorRunner;
 import 
org.apache.ambari.server.api.services.stackadvisor.commands.StackAdvisorCommand.StackAdvisorData;
+import 
org.apache.ambari.server.controller.internal.AmbariServerConfigurationCategory;
 import org.apache.ambari.server.state.ServiceInfo;
 import org.apache.commons.io.FileUtils;
 import org.codehaus.jackson.JsonNode;
@@ -318,7 +318,7 @@ public class StackAdvisorCommandTest {
     command.populateLdapConfiguration((ObjectNode)servicesRootNode);
 
     JsonNode expectedLdapConfig = json(
-      map(LDAP_CONFIGURATION_PROPERTY, ldapConfigData)
+      
map(AmbariServerConfigurationCategory.LDAP_CONFIGURATION.getCategoryName(), 
ldapConfigData)
     );
 
     assertEquals(expectedLdapConfig, servicesRootNode);

http://git-wip-us.apache.org/repos/asf/ambari/blob/4240f849/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationResourceProviderTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationResourceProviderTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationResourceProviderTest.java
index 5016160..13c644a 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationResourceProviderTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationResourceProviderTest.java
@@ -35,6 +35,7 @@ import java.util.TreeMap;
 
 import javax.persistence.EntityManager;
 
+import 
org.apache.ambari.server.api.services.RootServiceComponentConfigurationService;
 import org.apache.ambari.server.controller.RootComponent;
 import org.apache.ambari.server.controller.RootService;
 import org.apache.ambari.server.controller.predicate.AndPredicate;
@@ -42,6 +43,7 @@ import org.apache.ambari.server.controller.spi.Predicate;
 import org.apache.ambari.server.controller.spi.Request;
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.controller.spi.ResourceProvider;
+import org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.utilities.PredicateBuilder;
 import org.apache.ambari.server.events.AmbariConfigurationChangedEvent;
 import org.apache.ambari.server.events.publishers.AmbariEventPublisher;
@@ -60,6 +62,7 @@ import com.google.inject.AbstractModule;
 import com.google.inject.Guice;
 import com.google.inject.Injector;
 
+import edu.emory.mathcs.backport.java.util.Collections;
 import junit.framework.Assert;
 
 public class RootServiceComponentConfigurationResourceProviderTest extends 
EasyMockSupport {
@@ -74,30 +77,55 @@ public class 
RootServiceComponentConfigurationResourceProviderTest extends EasyM
 
   @Test
   public void testCreateResources_Administrator() throws Exception {
-    testCreateResources(TestAuthenticationFactory.createAdministrator());
+    testCreateResources(TestAuthenticationFactory.createAdministrator(), null);
   }
 
   @Test(expected = AuthorizationException.class)
   public void testCreateResources_ClusterAdministrator() throws Exception {
-    
testCreateResources(TestAuthenticationFactory.createClusterAdministrator());
+    
testCreateResources(TestAuthenticationFactory.createClusterAdministrator(), 
null);
   }
 
   @Test(expected = AuthorizationException.class)
   public void testCreateResources_ClusterOperator() throws Exception {
-    testCreateResources(TestAuthenticationFactory.createClusterOperator());
+    testCreateResources(TestAuthenticationFactory.createClusterOperator(), 
null);
   }
 
   @Test(expected = AuthorizationException.class)
   public void testCreateResources_ServiceAdministrator() throws Exception {
-    
testCreateResources(TestAuthenticationFactory.createServiceAdministrator());
+    
testCreateResources(TestAuthenticationFactory.createServiceAdministrator(), 
null);
   }
 
   @Test(expected = AuthorizationException.class)
   public void testCreateResources_ServiceOperator() throws Exception {
-    testCreateResources(TestAuthenticationFactory.createServiceOperator());
+    testCreateResources(TestAuthenticationFactory.createServiceOperator(), 
null);
   }
 
-  private void testCreateResources(Authentication authentication) throws 
Exception {
+  @Test
+  public void testCreateResourcesWithDirective_Administrator() throws 
Exception {
+    testCreateResources(TestAuthenticationFactory.createAdministrator(), 
"test-directive");
+  }
+
+  @Test(expected = AuthorizationException.class)
+  public void testCreateResourcesWithDirective_ClusterAdministrator() throws 
Exception {
+    
testCreateResources(TestAuthenticationFactory.createClusterAdministrator(), 
"test-directive");
+  }
+
+  @Test(expected = AuthorizationException.class)
+  public void testCreateResourcesWithDirective_ClusterOperator() throws 
Exception {
+    testCreateResources(TestAuthenticationFactory.createClusterOperator(), 
"test-directive");
+  }
+
+  @Test(expected = AuthorizationException.class)
+  public void testCreateResourcesWithDirective_ServiceAdministrator() throws 
Exception {
+    
testCreateResources(TestAuthenticationFactory.createServiceAdministrator(), 
"test-directive");
+  }
+
+  @Test(expected = AuthorizationException.class)
+  public void testCreateResourcesWithDirective_ServiceOperator() throws 
Exception {
+    testCreateResources(TestAuthenticationFactory.createServiceOperator(), 
"test-directive");
+  }
+
+  private void testCreateResources(Authentication authentication, String 
opDirective) throws Exception {
     Injector injector = createInjector();
 
     ResourceProvider resourceProvider = 
injector.getInstance(RootServiceComponentConfigurationResourceProvider.class);
@@ -110,38 +138,79 @@ public class 
RootServiceComponentConfigurationResourceProviderTest extends EasyM
     propertySets.add(toRequestProperties(CATEGORY_NAME_1, properties1));
 
     Map<String, String> properties2 = new HashMap<>();
-    properties2.put("property1b", "value1");
-    properties2.put("property2b", "value2");
-    propertySets.add(toRequestProperties(CATEGORY_NAME_2, properties2));
+    if (opDirective == null) {
+      properties2.put("property1b", "value1");
+      properties2.put("property2b", "value2");
+      propertySets.add(toRequestProperties(CATEGORY_NAME_2, properties2));
+    }
+
+    Map<String, String> requestInfoProperties;
+    if (opDirective == null) {
+      requestInfoProperties = Collections.emptyMap();
+    } else {
+      requestInfoProperties = 
Collections.singletonMap(RootServiceComponentConfigurationService.DIRECTIVE_OPERATION,
 opDirective);
+    }
 
     Request request = createMock(Request.class);
     expect(request.getProperties()).andReturn(propertySets).once();
+    
expect(request.getRequestInfoProperties()).andReturn(requestInfoProperties).once();
 
     Capture<Map<String, String>> capturedProperties1 = newCapture();
     Capture<Map<String, String>> capturedProperties2 = newCapture();
 
-    AmbariConfigurationDAO dao = 
injector.getInstance(AmbariConfigurationDAO.class);
-    expect(dao.reconcileCategory(eq(CATEGORY_NAME_1), 
capture(capturedProperties1), eq(true)))
-        .andReturn(true)
-        .once();
-    expect(dao.reconcileCategory(eq(CATEGORY_NAME_2), 
capture(capturedProperties2), eq(true)))
-        .andReturn(true)
-        .once();
+    if (opDirective == null) {
+      AmbariConfigurationDAO dao = 
injector.getInstance(AmbariConfigurationDAO.class);
+      expect(dao.reconcileCategory(eq(CATEGORY_NAME_1), 
capture(capturedProperties1), eq(true)))
+          .andReturn(true)
+          .once();
+      expect(dao.reconcileCategory(eq(CATEGORY_NAME_2), 
capture(capturedProperties2), eq(true)))
+          .andReturn(true)
+          .once();
 
-    AmbariEventPublisher publisher = 
injector.getInstance(AmbariEventPublisher.class);
-    publisher.publish(anyObject(AmbariConfigurationChangedEvent.class));
-    expectLastCall().times(2);
+
+      AmbariEventPublisher publisher = 
injector.getInstance(AmbariEventPublisher.class);
+      publisher.publish(anyObject(AmbariConfigurationChangedEvent.class));
+      expectLastCall().times(2);
+    }
+
+    RootServiceComponentConfigurationHandlerFactory factory = 
injector.getInstance(RootServiceComponentConfigurationHandlerFactory.class);
+    expect(factory.getInstance(RootService.AMBARI.name(), 
RootComponent.AMBARI_SERVER.name(), CATEGORY_NAME_1))
+        .andReturn(new AmbariServerConfigurationHandler())
+        .once();
+    if (opDirective == null) {
+      expect(factory.getInstance(RootService.AMBARI.name(), 
RootComponent.AMBARI_SERVER.name(), CATEGORY_NAME_2))
+          .andReturn(new AmbariServerConfigurationHandler())
+          .once();
+    }
 
     replayAll();
 
     SecurityContextHolder.getContext().setAuthentication(authentication);
 
-    resourceProvider.createResources(request);
+    try {
+      resourceProvider.createResources(request);
+      if (opDirective != null) {
+        Assert.fail("Expected SystemException to be thrown");
+      }
+    } catch (AuthorizationException e) {
+      throw e;
+    } catch (SystemException e) {
+      if (opDirective == null) {
+        Assert.fail("Unexpected exception: " + e.getMessage());
+      } else {
+        Assert.assertEquals("The requested operation is not supported for this 
category: " + CATEGORY_NAME_1, e.getMessage());
+      }
+    }
 
     verifyAll();
 
-    validateCapturedProperties(properties1, capturedProperties1);
-    validateCapturedProperties(properties2, capturedProperties2);
+    if (opDirective == null) {
+      validateCapturedProperties(properties1, capturedProperties1);
+      validateCapturedProperties(properties2, capturedProperties2);
+    } else {
+      Assert.assertFalse(capturedProperties1.hasCaptured());
+      Assert.assertFalse(capturedProperties2.hasCaptured());
+    }
   }
 
   @Test
@@ -185,6 +254,11 @@ public class 
RootServiceComponentConfigurationResourceProviderTest extends EasyM
     publisher.publish(anyObject(AmbariConfigurationChangedEvent.class));
     expectLastCall().once();
 
+    RootServiceComponentConfigurationHandlerFactory factory = 
injector.getInstance(RootServiceComponentConfigurationHandlerFactory.class);
+    expect(factory.getInstance(RootService.AMBARI.name(), 
RootComponent.AMBARI_SERVER.name(), CATEGORY_NAME_1))
+        .andReturn(new AmbariServerConfigurationHandler())
+        .once();
+
     replayAll();
 
     SecurityContextHolder.getContext().setAuthentication(authentication);
@@ -236,6 +310,11 @@ public class 
RootServiceComponentConfigurationResourceProviderTest extends EasyM
     AmbariConfigurationDAO dao = 
injector.getInstance(AmbariConfigurationDAO.class);
     
expect(dao.findByCategory(CATEGORY_NAME_1)).andReturn(createEntities(CATEGORY_NAME_1,
 properties)).once();
 
+    RootServiceComponentConfigurationHandlerFactory factory = 
injector.getInstance(RootServiceComponentConfigurationHandlerFactory.class);
+    expect(factory.getInstance(RootService.AMBARI.name(), 
RootComponent.AMBARI_SERVER.name(), CATEGORY_NAME_1))
+        .andReturn(new AmbariServerConfigurationHandler())
+        .once();
+
     replayAll();
 
     SecurityContextHolder.getContext().setAuthentication(authentication);
@@ -265,30 +344,55 @@ public class 
RootServiceComponentConfigurationResourceProviderTest extends EasyM
 
   @Test
   public void testUpdateResources_Administrator() throws Exception {
-    testUpdateResources(TestAuthenticationFactory.createAdministrator());
+    testUpdateResources(TestAuthenticationFactory.createAdministrator(), null);
   }
 
   @Test(expected = AuthorizationException.class)
   public void testUpdateResources_ClusterAdministrator() throws Exception {
-    
testUpdateResources(TestAuthenticationFactory.createClusterAdministrator());
+    
testUpdateResources(TestAuthenticationFactory.createClusterAdministrator(), 
null);
   }
 
   @Test(expected = AuthorizationException.class)
   public void testUpdateResources_ClusterOperator() throws Exception {
-    testUpdateResources(TestAuthenticationFactory.createClusterOperator());
+    testUpdateResources(TestAuthenticationFactory.createClusterOperator(), 
null);
   }
 
   @Test(expected = AuthorizationException.class)
   public void testUpdateResources_ServiceAdministrator() throws Exception {
-    
testUpdateResources(TestAuthenticationFactory.createServiceAdministrator());
+    
testUpdateResources(TestAuthenticationFactory.createServiceAdministrator(), 
null);
   }
 
   @Test(expected = AuthorizationException.class)
   public void testUpdateResources_ServiceOperator() throws Exception {
-    testUpdateResources(TestAuthenticationFactory.createServiceOperator());
+    testUpdateResources(TestAuthenticationFactory.createServiceOperator(), 
null);
+  }
+
+  @Test
+  public void testUpdateResourcesWithDirective_Administrator() throws 
Exception {
+    testUpdateResources(TestAuthenticationFactory.createAdministrator(), 
"test-directive");
+  }
+
+  @Test(expected = AuthorizationException.class)
+  public void testUpdateResourcesWithDirective_ClusterAdministrator() throws 
Exception {
+    
testUpdateResources(TestAuthenticationFactory.createClusterAdministrator(), 
"test-directive");
   }
 
-  private void testUpdateResources(Authentication authentication) throws 
Exception {
+  @Test(expected = AuthorizationException.class)
+  public void testUpdateResourcesWithDirective_ClusterOperator() throws 
Exception {
+    testUpdateResources(TestAuthenticationFactory.createClusterOperator(), 
"test-directive");
+  }
+
+  @Test(expected = AuthorizationException.class)
+  public void testUpdateResourcesWithDirective_ServiceAdministrator() throws 
Exception {
+    
testUpdateResources(TestAuthenticationFactory.createServiceAdministrator(), 
"test-directive");
+  }
+
+  @Test(expected = AuthorizationException.class)
+  public void testUpdateResourcesWithDirective_ServiceOperator() throws 
Exception {
+    testUpdateResources(TestAuthenticationFactory.createServiceOperator(), 
"test-directive");
+  }
+
+  private void testUpdateResources(Authentication authentication, String 
opDirective) throws Exception {
     Injector injector = createInjector();
 
     ResourceProvider resourceProvider = 
injector.getInstance(RootServiceComponentConfigurationResourceProvider.class);
@@ -302,29 +406,62 @@ public class 
RootServiceComponentConfigurationResourceProviderTest extends EasyM
     properties1.put("property2a", "value2");
     propertySets.add(toRequestProperties(CATEGORY_NAME_1, properties1));
 
+    Map<String, String> requestInfoProperties;
+    if (opDirective == null) {
+      requestInfoProperties = Collections.emptyMap();
+    } else {
+      requestInfoProperties = 
Collections.singletonMap(RootServiceComponentConfigurationService.DIRECTIVE_OPERATION,
 opDirective);
+    }
+
     Request request = createMock(Request.class);
     expect(request.getProperties()).andReturn(propertySets).once();
+    
expect(request.getRequestInfoProperties()).andReturn(requestInfoProperties).once();
 
     Capture<Map<String, String>> capturedProperties1 = newCapture();
 
-    AmbariConfigurationDAO dao = 
injector.getInstance(AmbariConfigurationDAO.class);
-    expect(dao.reconcileCategory(eq(CATEGORY_NAME_1), 
capture(capturedProperties1), eq(false)))
-        .andReturn(true)
-        .once();
+    if (opDirective == null) {
+      AmbariConfigurationDAO dao = 
injector.getInstance(AmbariConfigurationDAO.class);
+      expect(dao.reconcileCategory(eq(CATEGORY_NAME_1), 
capture(capturedProperties1), eq(false)))
+          .andReturn(true)
+          .once();
 
-    AmbariEventPublisher publisher = 
injector.getInstance(AmbariEventPublisher.class);
-    publisher.publish(anyObject(AmbariConfigurationChangedEvent.class));
-    expectLastCall().times(1);
+      AmbariEventPublisher publisher = 
injector.getInstance(AmbariEventPublisher.class);
+      publisher.publish(anyObject(AmbariConfigurationChangedEvent.class));
+      expectLastCall().times(1);
+    }
+
+    RootServiceComponentConfigurationHandlerFactory factory = 
injector.getInstance(RootServiceComponentConfigurationHandlerFactory.class);
+    expect(factory.getInstance(RootService.AMBARI.name(), 
RootComponent.AMBARI_SERVER.name(), CATEGORY_NAME_1))
+        .andReturn(new AmbariServerConfigurationHandler())
+        .once();
 
     replayAll();
 
     SecurityContextHolder.getContext().setAuthentication(authentication);
 
-    resourceProvider.updateResources(request, predicate);
+    try {
+      resourceProvider.updateResources(request, predicate);
+
+      if (opDirective != null) {
+        Assert.fail("Expected SystemException to be thrown");
+      }
+    } catch (AuthorizationException e) {
+      throw e;
+    } catch (SystemException e) {
+      if (opDirective == null) {
+        Assert.fail("Unexpected exception: " + e.getMessage());
+      } else {
+        Assert.assertEquals("The requested operation is not supported for this 
category: " + CATEGORY_NAME_1, e.getMessage());
+      }
+    }
 
     verifyAll();
 
-    validateCapturedProperties(properties1, capturedProperties1);
+    if (opDirective == null) {
+      validateCapturedProperties(properties1, capturedProperties1);
+    } else {
+      Assert.assertFalse(capturedProperties1.hasCaptured());
+    }
   }
 
   private Predicate createPredicate(String serviceName, String componentName, 
String categoryName) {
@@ -387,6 +524,9 @@ public class 
RootServiceComponentConfigurationResourceProviderTest extends EasyM
         
bind(EntityManager.class).toInstance(createNiceMock(EntityManager.class));
         
bind(AmbariConfigurationDAO.class).toInstance(createMock(AmbariConfigurationDAO.class));
         
bind(AmbariEventPublisher.class).toInstance(createMock(AmbariEventPublisher.class));
+        
bind(RootServiceComponentConfigurationHandlerFactory.class).toInstance(createMock(RootServiceComponentConfigurationHandlerFactory.class));
+
+        
binder().requestStaticInjection(AmbariServerConfigurationHandler.class);
       }
     });
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/4240f849/ambari-server/src/test/java/org/apache/ambari/server/ldap/LdapModuleFunctionalTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/ldap/LdapModuleFunctionalTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/ldap/LdapModuleFunctionalTest.java
index 3917cdf..75c9ea3 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/ldap/LdapModuleFunctionalTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/ldap/LdapModuleFunctionalTest.java
@@ -14,14 +14,18 @@
 
 package org.apache.ambari.server.ldap;
 
+import static org.easymock.EasyMock.createNiceMock;
+
 import java.util.Map;
 
-import org.apache.ambari.server.ldap.domain.AmbariLdapConfigKeys;
+import javax.persistence.EntityManager;
+
 import org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration;
-import org.apache.ambari.server.ldap.domain.AmbariLdapConfigurationFactory;
-import org.apache.ambari.server.ldap.domain.TestAmbariLdapConfigurationFactory;
+import org.apache.ambari.server.ldap.domain.AmbariLdapConfigurationKeys;
 import org.apache.ambari.server.ldap.service.ads.LdapConnectionTemplateFactory;
 import 
org.apache.ambari.server.ldap.service.ads.detectors.AttributeDetectorFactory;
+import org.apache.ambari.server.orm.DBAccessor;
+import org.apache.ambari.server.state.stack.OsFamily;
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.ldap.client.api.LdapConnection;
@@ -67,7 +71,9 @@ public class LdapModuleFunctionalTest {
       @Override
       protected void configure() {
         // override the configuration instance binding not to access the 
database
-        bind(AmbariLdapConfiguration.class).toInstance(new 
TestAmbariLdapConfigurationFactory().createLdapConfiguration(getADProps()));
+        
bind(EntityManager.class).toInstance(createNiceMock(EntityManager.class));
+        bind(DBAccessor.class).toInstance(createNiceMock(DBAccessor.class));
+        bind(OsFamily.class).toInstance(createNiceMock(OsFamily.class));
       }
     });
 
@@ -82,8 +88,7 @@ public class LdapModuleFunctionalTest {
 
     // WHEN
     LdapConnectionTemplateFactory ldapConnectionTemplateFactory = 
injector.getInstance(LdapConnectionTemplateFactory.class);
-    AmbariLdapConfigurationFactory ambariLdapConfigurationFactory = 
injector.getInstance(AmbariLdapConfigurationFactory.class);
-    AmbariLdapConfiguration ldapConfiguration = 
ambariLdapConfigurationFactory.createLdapConfiguration(getADProps());
+    AmbariLdapConfiguration ldapConfiguration = new 
AmbariLdapConfiguration(getProps());
     LdapConnectionTemplate template = 
ldapConnectionTemplateFactory.create(ldapConfiguration);
 
     // THEN
@@ -103,36 +108,28 @@ public class LdapModuleFunctionalTest {
   }
 
 
-  private static Map<String, Object> getProps() {
-    Map<String, Object> ldapPropsMap = Maps.newHashMap();
+  private static Map<String, String> getProps() {
+    Map<String, String> ldapPropsMap = Maps.newHashMap();
 
-    ldapPropsMap.put(AmbariLdapConfigKeys.ANONYMOUS_BIND.key(), "true");
-    ldapPropsMap.put(AmbariLdapConfigKeys.SERVER_HOST.key(), 
"ldap.forumsys.com");
-    ldapPropsMap.put(AmbariLdapConfigKeys.SERVER_PORT.key(), "389");
-    ldapPropsMap.put(AmbariLdapConfigKeys.BIND_DN.key(), 
"cn=read-only-admin,dc=example,dc=com");
-    ldapPropsMap.put(AmbariLdapConfigKeys.BIND_PASSWORD.key(), "password");
+    ldapPropsMap.put(AmbariLdapConfigurationKeys.ANONYMOUS_BIND.key(), "true");
+    ldapPropsMap.put(AmbariLdapConfigurationKeys.SERVER_HOST.key(), 
"ldap.forumsys.com");
+    ldapPropsMap.put(AmbariLdapConfigurationKeys.SERVER_PORT.key(), "389");
+    ldapPropsMap.put(AmbariLdapConfigurationKeys.BIND_DN.key(), 
"cn=read-only-admin,dc=example,dc=com");
+    ldapPropsMap.put(AmbariLdapConfigurationKeys.BIND_PASSWORD.key(), 
"password");
 //    ldapPropsMap.put(AmbariLdapConfigKeys.USE_SSL.key(), "true");
 
-    ldapPropsMap.put(AmbariLdapConfigKeys.USER_OBJECT_CLASS.key(), 
SchemaConstants.PERSON_OC);
-    ldapPropsMap.put(AmbariLdapConfigKeys.USER_NAME_ATTRIBUTE.key(), 
SchemaConstants.UID_AT);
-    ldapPropsMap.put(AmbariLdapConfigKeys.USER_SEARCH_BASE.key(), 
"dc=example,dc=com");
-    ldapPropsMap.put(AmbariLdapConfigKeys.DN_ATTRIBUTE.key(), 
SchemaConstants.UID_AT);
+    ldapPropsMap.put(AmbariLdapConfigurationKeys.USER_OBJECT_CLASS.key(), 
SchemaConstants.PERSON_OC);
+    ldapPropsMap.put(AmbariLdapConfigurationKeys.USER_NAME_ATTRIBUTE.key(), 
SchemaConstants.UID_AT);
+    ldapPropsMap.put(AmbariLdapConfigurationKeys.USER_SEARCH_BASE.key(), 
"dc=example,dc=com");
+    ldapPropsMap.put(AmbariLdapConfigurationKeys.DN_ATTRIBUTE.key(), 
SchemaConstants.UID_AT);
 //    ldapPropsMap.put(AmbariLdapConfigKeys.TRUST_STORE.key(), "custom");
-    ldapPropsMap.put(AmbariLdapConfigKeys.TRUST_STORE_TYPE.key(), "JKS");
+    ldapPropsMap.put(AmbariLdapConfigurationKeys.TRUST_STORE_TYPE.key(), 
"JKS");
 //    ldapPropsMap.put(AmbariLdapConfigKeys.TRUST_STORE_PATH.key(), 
"/Users/lpuskas/my_truststore/KeyStore.jks");
 
 
     return ldapPropsMap;
   }
 
-  private static Map<String, String> getADProps() {
-    Map<String, String> ldapPropsMap = Maps.newHashMap();
-
-
-
-    return ldapPropsMap;
-  }
-
   @Test
   public void testShouldDetectorsBeBound() throws Exception {
     // GIVEN

http://git-wip-us.apache.org/repos/asf/ambari/blob/4240f849/ambari-server/src/test/java/org/apache/ambari/server/ldap/domain/TestAmbariLdapConfigurationFactory.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/ldap/domain/TestAmbariLdapConfigurationFactory.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/ldap/domain/TestAmbariLdapConfigurationFactory.java
deleted file mode 100644
index 1082250..0000000
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/ldap/domain/TestAmbariLdapConfigurationFactory.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ambari.server.ldap.domain;
-
-
-import java.util.Map;
-
-/**
- * Implementation used for testing purposes only!
- */
-public class TestAmbariLdapConfigurationFactory implements 
AmbariLdapConfigurationFactory {
-
-  @Override
-  public AmbariLdapConfiguration createLdapConfiguration(Map<String, String> 
configuration) {
-    return new AmbariLdapConfiguration(configuration);
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/4240f849/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/AmbariLdapFacadeTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/AmbariLdapFacadeTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/AmbariLdapFacadeTest.java
index 97ce30e..59622b5 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/AmbariLdapFacadeTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/AmbariLdapFacadeTest.java
@@ -17,10 +17,8 @@ package org.apache.ambari.server.ldap.service;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.ambari.server.ldap.domain.AmbariLdapConfigKeys;
 import org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration;
-import org.apache.ambari.server.ldap.domain.AmbariLdapConfigurationFactory;
-import org.apache.ambari.server.ldap.domain.TestAmbariLdapConfigurationFactory;
+import org.apache.ambari.server.ldap.domain.AmbariLdapConfigurationKeys;
 import org.easymock.Capture;
 import org.easymock.EasyMock;
 import org.easymock.EasyMockRule;
@@ -50,9 +48,6 @@ public class AmbariLdapFacadeTest extends EasyMockSupport {
   @Mock(type = MockType.STRICT)
   public LdapAttributeDetectionService ldapAttributeDetectionServiceMock;
 
-  private AmbariLdapConfigurationFactory ambariLdapConfigurationFactory;
-
-
   @TestSubject
   private LdapFacade ldapFacade = new AmbariLdapFacade();
 
@@ -63,8 +58,7 @@ public class AmbariLdapFacadeTest extends EasyMockSupport {
 
   @Before
   public void before() {
-    ambariLdapConfigurationFactory = new TestAmbariLdapConfigurationFactory();
-    ambariLdapConfiguration = 
ambariLdapConfigurationFactory.createLdapConfiguration(Maps.newHashMap());
+    ambariLdapConfiguration = new AmbariLdapConfiguration(Maps.newHashMap());
     ambariLdapConfigurationCapture = Capture.newInstance();
 
 
@@ -90,7 +84,7 @@ public class AmbariLdapFacadeTest extends EasyMockSupport {
     // THEN
     // the captured configuration instance is the same the facade method got 
called with
     Assert.assertEquals("The configuration instance souldn't change before 
passing it to the service",
-      ambariLdapConfiguration, ambariLdapConfigurationCapture.getValue());
+        ambariLdapConfiguration, ambariLdapConfigurationCapture.getValue());
   }
 
   @Test(expected = AmbariLdapException.class)
@@ -122,10 +116,10 @@ public class AmbariLdapFacadeTest extends EasyMockSupport 
{
     Capture<String> userDnCapture = Capture.newInstance();
 
     
EasyMock.expect(ldapConfigurationServiceMock.checkUserAttributes(EasyMock.capture(testUserCapture),
 EasyMock.capture(testPasswordCapture),
-      EasyMock.capture(ambariLdapConfigurationCapture))).andReturn("userDn");
+        EasyMock.capture(ambariLdapConfigurationCapture))).andReturn("userDn");
 
     
EasyMock.expect(ldapConfigurationServiceMock.checkGroupAttributes(EasyMock.capture(userDnCapture),
-      
EasyMock.capture(ambariLdapConfigurationCapture))).andReturn(Sets.newHashSet("userGroup"));
+        
EasyMock.capture(ambariLdapConfigurationCapture))).andReturn(Sets.newHashSet("userGroup"));
 
     replayAll();
 
@@ -149,7 +143,7 @@ public class AmbariLdapFacadeTest extends EasyMockSupport {
     
parameters.put(AmbariLdapFacade.Parameters.TEST_USER_PASSWORD.getParameterKey(),
 "testPassword");
 
     
EasyMock.expect(ldapConfigurationServiceMock.checkUserAttributes(EasyMock.anyString(),
 EasyMock.anyString(),
-      EasyMock.anyObject(AmbariLdapConfiguration.class))).andThrow(new 
AmbariLdapException("Testing ..."));
+        EasyMock.anyObject(AmbariLdapConfiguration.class))).andThrow(new 
AmbariLdapException("Testing ..."));
 
     replayAll();
 
@@ -164,23 +158,23 @@ public class AmbariLdapFacadeTest extends EasyMockSupport 
{
 
     // configuration map with user attributes detected
     Map<String, String> userConfigMap = Maps.newHashMap();
-    userConfigMap.put(AmbariLdapConfigKeys.USER_NAME_ATTRIBUTE.key(), "uid");
-    AmbariLdapConfiguration userAttrDecoratedConfig = 
ambariLdapConfigurationFactory.createLdapConfiguration(userConfigMap);
+    userConfigMap.put(AmbariLdapConfigurationKeys.USER_NAME_ATTRIBUTE.key(), 
"uid");
+    AmbariLdapConfiguration userAttrDecoratedConfig = new 
AmbariLdapConfiguration(userConfigMap);
 
     // configuration map with user+group attributes detected
     Map<String, String> groupConfigMap = Maps.newHashMap(userConfigMap);
-    groupConfigMap.put(AmbariLdapConfigKeys.GROUP_NAME_ATTRIBUTE.key(), "dn");
-    AmbariLdapConfiguration groupAttrDecoratedConfig = 
ambariLdapConfigurationFactory.createLdapConfiguration(groupConfigMap);
+    groupConfigMap.put(AmbariLdapConfigurationKeys.GROUP_NAME_ATTRIBUTE.key(), 
"dn");
+    AmbariLdapConfiguration groupAttrDecoratedConfig = new 
AmbariLdapConfiguration(groupConfigMap);
 
     Capture<AmbariLdapConfiguration> userAttrDetectionConfigCapture = 
Capture.newInstance();
     Capture<AmbariLdapConfiguration> groupAttrDetectionConfigCapture = 
Capture.newInstance();
 
     // GIVEN
     
EasyMock.expect(ldapAttributeDetectionServiceMock.detectLdapUserAttributes(EasyMock.capture(userAttrDetectionConfigCapture)))
-      .andReturn(userAttrDecoratedConfig);
+        .andReturn(userAttrDecoratedConfig);
 
     
EasyMock.expect(ldapAttributeDetectionServiceMock.detectLdapGroupAttributes(EasyMock.capture(groupAttrDetectionConfigCapture)))
-      .andReturn(groupAttrDecoratedConfig);
+        .andReturn(groupAttrDecoratedConfig);
 
     replayAll();
 
@@ -189,10 +183,10 @@ public class AmbariLdapFacadeTest extends EasyMockSupport 
{
 
     // THEN
     Assert.assertEquals("User attribute detection called with the wrong 
configuration", ambariLdapConfiguration,
-      userAttrDetectionConfigCapture.getValue());
+        userAttrDetectionConfigCapture.getValue());
 
     Assert.assertEquals("Group attribute detection called with the wrong 
configuration", userAttrDecoratedConfig,
-      groupAttrDetectionConfigCapture.getValue());
+        groupAttrDetectionConfigCapture.getValue());
 
     Assert.assertEquals("Attribute detection returned an invalid 
configuration", groupAttrDecoratedConfig, detected);
 
@@ -202,7 +196,7 @@ public class AmbariLdapFacadeTest extends EasyMockSupport {
   public void 
testShouldAttributeDetectionFailuresResultInAmbariLdapException() throws 
Exception {
     // GIVEN
     
EasyMock.expect(ldapAttributeDetectionServiceMock.detectLdapUserAttributes(EasyMock.anyObject(AmbariLdapConfiguration.class)))
-      .andThrow(new AmbariLdapException("Testing ..."));
+        .andThrow(new AmbariLdapException("Testing ..."));
 
     replayAll();
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/4240f849/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionServiceTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionServiceTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionServiceTest.java
index a44bf7c..e23421e 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionServiceTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionServiceTest.java
@@ -17,10 +17,8 @@ package org.apache.ambari.server.ldap.service.ads;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.ambari.server.ldap.domain.AmbariLdapConfigKeys;
 import org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration;
-import org.apache.ambari.server.ldap.domain.AmbariLdapConfigurationFactory;
-import org.apache.ambari.server.ldap.domain.TestAmbariLdapConfigurationFactory;
+import org.apache.ambari.server.ldap.domain.AmbariLdapConfigurationKeys;
 import org.apache.ambari.server.ldap.service.AmbariLdapException;
 import 
org.apache.ambari.server.ldap.service.ads.detectors.AttributeDetectorFactory;
 import 
org.apache.ambari.server.ldap.service.ads.detectors.ChainedAttributeDetector;
@@ -63,9 +61,6 @@ public class DefaultLdapAttributeDetectionServiceTest extends 
EasyMockSupport {
   @Mock
   private SearchRequest searchRequestMock;
 
-
-  private AmbariLdapConfigurationFactory ldapConfigurationFactory = new 
TestAmbariLdapConfigurationFactory();
-
   @TestSubject
   private DefaultLdapAttributeDetectionService 
defaultLdapAttributeDetectionService = new 
DefaultLdapAttributeDetectionService();
 
@@ -79,8 +74,8 @@ public class DefaultLdapAttributeDetectionServiceTest extends 
EasyMockSupport {
   public void shouldLdapUserAttributeDetection() throws Exception {
     // GIVEN
     Map<String, String> configMap = Maps.newHashMap();
-    configMap.put(AmbariLdapConfigKeys.USER_SEARCH_BASE.key(), 
"dc=example,dc=com");
-    AmbariLdapConfiguration ldapConfiguration = 
ldapConfigurationFactory.createLdapConfiguration(configMap);
+    configMap.put(AmbariLdapConfigurationKeys.USER_SEARCH_BASE.key(), 
"dc=example,dc=com");
+    AmbariLdapConfiguration ldapConfiguration = new 
AmbariLdapConfiguration(configMap);
 
     List<Object> entryList = Lists.newArrayList(new DefaultEntry("uid=gauss"));
 
@@ -110,8 +105,8 @@ public class DefaultLdapAttributeDetectionServiceTest 
extends EasyMockSupport {
   public void testShouldUserAttributeDetectionFailWhenLdapOerationFails() 
throws Exception {
     // GIVEN
     Map<String, String> configMap = Maps.newHashMap();
-    configMap.put(AmbariLdapConfigKeys.USER_SEARCH_BASE.key(), 
"dc=example,dc=com");
-    AmbariLdapConfiguration ldapConfiguration = 
ldapConfigurationFactory.createLdapConfiguration(configMap);
+    configMap.put(AmbariLdapConfigurationKeys.USER_SEARCH_BASE.key(), 
"dc=example,dc=com");
+    AmbariLdapConfiguration ldapConfiguration = new 
AmbariLdapConfiguration(configMap);
 
     
EasyMock.expect(ldapConnectionTemplateFactoryMock.create(ldapConfiguration)).andThrow(new
 AmbariLdapException("Testing ..."));
 
@@ -130,8 +125,8 @@ public class DefaultLdapAttributeDetectionServiceTest 
extends EasyMockSupport {
   public void shouldLdapGroupAttributeDetection() throws Exception {
     // GIVEN
     Map<String, String> configMap = Maps.newHashMap();
-    configMap.put(AmbariLdapConfigKeys.GROUP_SEARCH_BASE.key(), 
"dc=example,dc=com");
-    AmbariLdapConfiguration ldapConfiguration = 
ldapConfigurationFactory.createLdapConfiguration(configMap);
+    configMap.put(AmbariLdapConfigurationKeys.GROUP_SEARCH_BASE.key(), 
"dc=example,dc=com");
+    AmbariLdapConfiguration ldapConfiguration = new 
AmbariLdapConfiguration(configMap);
 
     List<Object> entryList = Lists.newArrayList(new DefaultEntry("uid=gauss"));
 
@@ -161,8 +156,8 @@ public class DefaultLdapAttributeDetectionServiceTest 
extends EasyMockSupport {
   public void testShouldGroupAttributeDetectionFailWhenLdapOerationFails() 
throws Exception {
     // GIVEN
     Map<String, String> configMap = Maps.newHashMap();
-    configMap.put(AmbariLdapConfigKeys.GROUP_SEARCH_BASE.key(), 
"dc=example,dc=com");
-    AmbariLdapConfiguration ldapConfiguration = 
ldapConfigurationFactory.createLdapConfiguration(configMap);
+    configMap.put(AmbariLdapConfigurationKeys.GROUP_SEARCH_BASE.key(), 
"dc=example,dc=com");
+    AmbariLdapConfiguration ldapConfiguration = new 
AmbariLdapConfiguration(configMap);
 
     
EasyMock.expect(ldapConnectionTemplateFactoryMock.create(ldapConfiguration)).andThrow(new
 AmbariLdapException("Testing ..."));
 
@@ -175,7 +170,6 @@ public class DefaultLdapAttributeDetectionServiceTest 
extends EasyMockSupport {
 
   }
 
-
   private EntryMapper<Entry> entryMapperMock() {
     return new EntryMapper<Entry>() {
       @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/4240f849/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConfigurationServiceTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConfigurationServiceTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConfigurationServiceTest.java
index ec78e56..998844c 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConfigurationServiceTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConfigurationServiceTest.java
@@ -17,9 +17,8 @@ package org.apache.ambari.server.ldap.service.ads;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.ambari.server.ldap.domain.AmbariLdapConfigKeys;
 import org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration;
-import org.apache.ambari.server.ldap.domain.TestAmbariLdapConfigurationFactory;
+import org.apache.ambari.server.ldap.domain.AmbariLdapConfigurationKeys;
 import org.apache.ambari.server.ldap.service.AmbariLdapException;
 import org.apache.ambari.server.ldap.service.LdapConfigurationService;
 import org.apache.directory.api.ldap.model.message.SearchRequest;
@@ -65,7 +64,7 @@ public class DefaultLdapConfigurationServiceTest extends 
EasyMockSupport {
   @Test
   public void testShouldConnectionCheckSucceedWhenConnectionCallbackSucceeds() 
throws Exception {
     // GIVEN
-    AmbariLdapConfiguration ambariLdapConfiguration = new 
TestAmbariLdapConfigurationFactory().createLdapConfiguration(Maps.newHashMap());
+    AmbariLdapConfiguration ambariLdapConfiguration = new 
AmbariLdapConfiguration(Maps.newHashMap());
 
     // the cllback returns TRUE
     
EasyMock.expect(ldapConnectionTemplateMock.execute(EasyMock.anyObject(ConnectionCallback.class))).andReturn(Boolean.TRUE);
@@ -84,7 +83,7 @@ public class DefaultLdapConfigurationServiceTest extends 
EasyMockSupport {
   public void testShouldConnectionCheckFailWhenConnectionCallbackFails() 
throws Exception {
 
     // GIVEN
-    AmbariLdapConfiguration ambariLdapConfiguration = new 
TestAmbariLdapConfigurationFactory().createLdapConfiguration(Maps.newHashMap());
+    AmbariLdapConfiguration ambariLdapConfiguration = new 
AmbariLdapConfiguration(Maps.newHashMap());
 
     // the callback returns FALSE
     
EasyMock.expect(ldapConnectionTemplateMock.execute(EasyMock.anyObject(ConnectionCallback.class))).andReturn(Boolean.FALSE);
@@ -103,10 +102,10 @@ public class DefaultLdapConfigurationServiceTest extends 
EasyMockSupport {
   public void 
testShouldUserAttributeConfigurationCheckSucceedWhenUserDnIsFound() throws 
Exception {
     // GIVEN
     Map<String, String> configMap = Maps.newHashMap();
-    configMap.put(AmbariLdapConfigKeys.USER_OBJECT_CLASS.key(), "person");
-    configMap.put(AmbariLdapConfigKeys.USER_NAME_ATTRIBUTE.key(), "uid");
+    configMap.put(AmbariLdapConfigurationKeys.USER_OBJECT_CLASS.key(), 
"person");
+    configMap.put(AmbariLdapConfigurationKeys.USER_NAME_ATTRIBUTE.key(), 
"uid");
 
-    AmbariLdapConfiguration ambariLdapConfiguration = new 
TestAmbariLdapConfigurationFactory().createLdapConfiguration(configMap);
+    AmbariLdapConfiguration ambariLdapConfiguration = new 
AmbariLdapConfiguration(configMap);
 
     // the callback returns FALSE
     
EasyMock.expect(ldapConnectionTemplateFactory.create(ambariLdapConfiguration)).andReturn(ldapConnectionTemplateMock);
@@ -127,10 +126,10 @@ public class DefaultLdapConfigurationServiceTest extends 
EasyMockSupport {
   public void testShouldUserAttributeConfigurationCheckFailWhenNoUsersFound() 
throws Exception {
     // GIVEN
     Map<String, String> configMap = Maps.newHashMap();
-    configMap.put(AmbariLdapConfigKeys.USER_OBJECT_CLASS.key(), 
"posixAccount");
-    configMap.put(AmbariLdapConfigKeys.USER_NAME_ATTRIBUTE.key(), "dn");
+    configMap.put(AmbariLdapConfigurationKeys.USER_OBJECT_CLASS.key(), 
"posixAccount");
+    configMap.put(AmbariLdapConfigurationKeys.USER_NAME_ATTRIBUTE.key(), "dn");
 
-    AmbariLdapConfiguration ambariLdapConfiguration = new 
TestAmbariLdapConfigurationFactory().createLdapConfiguration(configMap);
+    AmbariLdapConfiguration ambariLdapConfiguration = new 
AmbariLdapConfiguration(configMap);
 
     // the callback returns FALSE
     
EasyMock.expect(ldapConnectionTemplateFactory.create(ambariLdapConfiguration)).andReturn(ldapConnectionTemplateMock);
@@ -159,7 +158,7 @@ public class DefaultLdapConfigurationServiceTest extends 
EasyMockSupport {
 
     SearchRequest sr = new SearchRequestImpl();
 
-    AmbariLdapConfiguration ambariLdapConfiguration = new 
TestAmbariLdapConfigurationFactory().createLdapConfiguration(configMap);
+    AmbariLdapConfiguration ambariLdapConfiguration = new 
AmbariLdapConfiguration(configMap);
 
     // the callback returns FALSE
     
EasyMock.expect(ldapConnectionTemplateFactory.create(ambariLdapConfiguration)).andReturn(ldapConnectionTemplateMock);
@@ -188,7 +187,7 @@ public class DefaultLdapConfigurationServiceTest extends 
EasyMockSupport {
 
     SearchRequest sr = new SearchRequestImpl();
 
-    AmbariLdapConfiguration ambariLdapConfiguration = new 
TestAmbariLdapConfigurationFactory().createLdapConfiguration(configMap);
+    AmbariLdapConfiguration ambariLdapConfiguration = new 
AmbariLdapConfiguration(configMap);
 
     // the callback returns FALSE
     
EasyMock.expect(ldapConnectionTemplateFactory.create(ambariLdapConfiguration)).andReturn(ldapConnectionTemplateMock);
@@ -210,10 +209,10 @@ public class DefaultLdapConfigurationServiceTest extends 
EasyMockSupport {
 
   private Map<String, String> groupConfigObjectMap() {
     Map<String, String> configMap = Maps.newHashMap();
-    configMap.put(AmbariLdapConfigKeys.GROUP_OBJECT_CLASS.key(), 
"groupOfNames");
-    configMap.put(AmbariLdapConfigKeys.GROUP_SEARCH_BASE.key(), 
"dc=example,dc=com");
-    configMap.put(AmbariLdapConfigKeys.GROUP_NAME_ATTRIBUTE.key(), "uid");
-    configMap.put(AmbariLdapConfigKeys.GROUP_MEMBER_ATTRIBUTE.key(), "member");
+    configMap.put(AmbariLdapConfigurationKeys.GROUP_OBJECT_CLASS.key(), 
"groupOfNames");
+    configMap.put(AmbariLdapConfigurationKeys.GROUP_SEARCH_BASE.key(), 
"dc=example,dc=com");
+    configMap.put(AmbariLdapConfigurationKeys.GROUP_NAME_ATTRIBUTE.key(), 
"uid");
+    configMap.put(AmbariLdapConfigurationKeys.GROUP_MEMBER_ATTRIBUTE.key(), 
"member");
     return configMap;
   }
 

Reply via email to