cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From du...@apache.org
Subject [10/20] General cleanup, source formatting, remove whitespace
Date Sat, 31 Aug 2013 21:11:55 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25e8e9b8/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapManagerImplSpec.groovy
----------------------------------------------------------------------
diff --git a/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapManagerImplSpec.groovy b/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapManagerImplSpec.groovy
index 548057c..7492919 100644
--- a/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapManagerImplSpec.groovy
+++ b/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapManagerImplSpec.groovy
@@ -16,260 +16,299 @@
 // under the License.
 package groovy.org.apache.cloudstack.ldap
 
-import javax.naming.NamingException
-import javax.naming.ldap.InitialLdapContext
 
-import org.apache.cloudstack.api.command.LdapListConfigurationCmd
-import org.apache.cloudstack.ldap.*
-import org.apache.cloudstack.ldap.dao.LdapConfigurationDaoImpl
+class LdapManagerImplSpec extends spock.lang.Specification {
+    def "Test failing of getUser due to bind issue"() {
+	given: "We have an LdapConfigurationDao, LdapContextFactory, LdapUserManager and LdapManager"
+	def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
+	def ldapContextFactory = Mock(LdapContextFactory)
+	def ldapUserManager = Mock(LdapUserManager)
+	ldapContextFactory.createBindContext() >> { throw new NamingException() }
+	def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
+	when: "We search for a user but there is a bind issue"
+	ldapManager.getUser("rmurphy")
+	then: "an exception is thrown"
+	thrown NamingException
+    }
 
-import com.cloud.exception.InvalidParameterValueException
-import com.cloud.utils.Pair
+    def "Test failing of getUsers due to bind issue"() {
+	given: "We have an LdapConfigurationDao, LdapContextFactory, LdapUserManager and LdapManager"
+	def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
+	def ldapContextFactory = Mock(LdapContextFactory)
+	def ldapUserManager = Mock(LdapUserManager)
+	ldapContextFactory.createBindContext() >> { throw new NamingException() }
+	def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
+	when: "We search for a group of users but there is a bind issue"
+	ldapManager.getUsers()
+	then: "An exception is thrown"
+	thrown NoLdapUserMatchingQueryException
+    }
 
-class LdapManagerImplSpec extends spock.lang.Specification {
-    def "Test that addConfiguration fails when a duplicate configuration exists"() {
-        given:
-        def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
-        def ldapContextFactory = Mock(LdapContextFactory)
-        def ldapUserManager = Mock(LdapUserManager)
-        ldapConfigurationDao.findByHostname(_) >> new LdapConfigurationVO("localhost", 389)
-        def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
-        when:
-        ldapManager.addConfiguration("localhost", 389)
-        then:
-        thrown InvalidParameterValueException
+    def "Test failing of searchUsers due to a failure to bind"() {
+	given: "We have an LdapConfigurationDao, LdapContextFactory, LdapUserManager and LdapManager"
+	def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
+	def ldapContextFactory = Mock(LdapContextFactory)
+	def ldapUserManager = Mock(LdapUserManager)
+	ldapContextFactory.createBindContext() >> { throw new NamingException() }
+	def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
+	when: "We search for users"
+	ldapManager.searchUsers("rmurphy")
+	then: "An exception is thrown"
+	thrown NoLdapUserMatchingQueryException
     }
 
-    def "Test that addConfiguration fails when a binding fails"() {
-        given:
-        def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
-        def ldapContextFactory = Mock(LdapContextFactory)
-        def ldapUserManager = Mock(LdapUserManager)
-        ldapContextFactory.createBindContext(_) >> { throw new NamingException() }
-        def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
-        when:
-        ldapManager.addConfiguration("localhost", 389)
-        then:
-        thrown InvalidParameterValueException
+    def "Test LdapConfigurationResponse generation"() {
+	given: "We have an LdapConfigurationDao, LdapContextFactory, LdapUserManager and LdapManager"
+	def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
+	def ldapContextFactory = Mock(LdapContextFactory)
+	def ldapUserManager = Mock(LdapUserManager)
+	def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
+	when: "A ldap configuration response is generated"
+	def result = ldapManager.createLdapConfigurationResponse(new LdapConfigurationVO("localhost", 389))
+	then: "the result of the response should match the given LdapConfigurationVO"
+	result.hostname == "localhost"
+	result.port == 389
     }
 
-    def "Test successfully addConfiguration"() {
-        given:
-        def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
-        def ldapContextFactory = Mock(LdapContextFactory)
-        def ldapUserManager = Mock(LdapUserManager)
-        ldapContextFactory.createBindContext(_) >> null
-        ldapConfigurationDao.persist(_) >> null
-        def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
-        when:
-        def result = ldapManager.addConfiguration("localhost", 389)
-        then:
-        result.hostname == "localhost"
-        result.port == 389
+    def "Test LdapUserResponse generation"() {
+	given: "We have an LdapConfigurationDao, LdapContextFactory, LdapUserManager and LdapManager"
+	def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
+	def ldapContextFactory = Mock(LdapContextFactory)
+	def ldapUserManager = Mock(LdapUserManager)
+	def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
+	when: "A ldap user response is generated"
+	def result = ldapManager.createLdapUserResponse(new LdapUser("rmurphy", "rmurphy@test.com", "Ryan", "Murphy", "cn=rmurphy,dc=cloudstack,dc=org"))
+	then: "TThe result of the response should match the given ldap user"
+	result.username == "rmurphy"
+	result.email == "rmurphy@test.com"
+	result.firstname == "Ryan"
+	result.lastname == "Murphy"
+	result.principal == "cn=rmurphy,dc=cloudstack,dc=org"
     }
 
-    def "Test successful failed result from deleteConfiguration due to configuration not existing"() {
-        given:
-        def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
-        def ldapContextFactory = Mock(LdapContextFactory)
-        def ldapUserManager = Mock(LdapUserManager)
-        ldapConfigurationDao.findByHostname(_) >> null
-        def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
-        when:
-        ldapManager.deleteConfiguration("localhost")
-        then:
-        thrown InvalidParameterValueException
+    def "Test success getUsers"() {
+	given: "We have an LdapConfigurationDao, LdapContextFactory, LdapUserManager and LdapManager"
+	def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
+	def ldapContextFactory = Mock(LdapContextFactory)
+	def ldapUserManager = Mock(LdapUserManager)
+	ldapContextFactory.createBindContext() >> null
+	List<LdapUser> users = new ArrayList<>();
+	users.add(new LdapUser("rmurphy", "rmurphy@test.com", "Ryan", "Murphy", "cn=rmurphy,dc=cloudstack,dc=org"))
+	ldapUserManager.getUsers(_) >> users;
+	def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
+	when: "We search for a group of users"
+	def result = ldapManager.getUsers()
+	then: "A list greater than 0 is returned"
+	result.size() > 0;
     }
 
-    def "Test successful result from deleteConfiguration"() {
-        given:
-        def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
-        def ldapContextFactory = Mock(LdapContextFactory)
-        def ldapUserManager = Mock(LdapUserManager)
-        ldapConfigurationDao.findByHostname(_) >> {
-            def configuration = new LdapConfigurationVO("localhost", 389)
-            configuration.setId(0);
-            return configuration;
-        }
-        ldapConfigurationDao.remove(_) >> null
-        def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
-        when:
-        def result = ldapManager.deleteConfiguration("localhost")
-        then:
-        result.hostname == "localhost"
-        result.port == 389
+    def "Test success of getUser"() {
+	given: "We have an LdapConfigurationDao, LdapContextFactory, LdapUserManager and LdapManager"
+	def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
+	def ldapContextFactory = Mock(LdapContextFactory)
+	def ldapUserManager = Mock(LdapUserManager)
+	ldapContextFactory.createBindContext() >> null
+	ldapUserManager.getUser(_, _) >> new LdapUser("rmurphy", "rmurphy@test.com", "Ryan", "Murphy", "cn=rmurphy,dc=cloudstack,dc=org")
+	def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
+	when: "We search for a user"
+	def result = ldapManager.getUser("rmurphy")
+	then: "The user is returned"
+	result.username == "rmurphy"
+	result.email == "rmurphy@test.com"
+	result.firstname == "Ryan"
+	result.lastname == "Murphy"
+	result.principal == "cn=rmurphy,dc=cloudstack,dc=org"
     }
 
-    def "Test successful failed result from canAuthenticate due to user not found"() {
-        given:
-        def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
-        def ldapContextFactory = Mock(LdapContextFactory)
-        def ldapUserManager = Mock(LdapUserManager)
-        def ldapManager = Spy(LdapManagerImpl, constructorArgs: [ldapConfigurationDao, ldapContextFactory, ldapUserManager])
-        ldapManager.getUser(_) >> { throw new NamingException() }
-        when:
-        def result = ldapManager.canAuthenticate("rmurphy", "password")
-        then:
-        result == false
+    def "Test successful closing of context"() {
+	given: "We have an LdapConfigurationDao, LdapContextFactory, LdapUserManager and LdapManager"
+	def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
+	def ldapContextFactory = Mock(LdapContextFactory)
+	def ldapUserManager = Mock(LdapUserManager)
+	def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
+	when: "The context is closed"
+	def context = Mock(InitialLdapContext)
+	ldapManager.closeContext(context)
+	then: "The context is null"
+	context.defaultInitCtx == null
     }
 
     def "Test successful failed result from canAuthenticate due to bad password"() {
-        given:
+	given: "We have an LdapConfigurationDao, LdapContextFactory, LdapUserManager and LdapManager"
         def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
         def ldapContextFactory = Mock(LdapContextFactory)
         ldapContextFactory.createUserContext(_, _) >> { throw new NamingException() }
         def ldapUserManager = Mock(LdapUserManager)
         def ldapManager = Spy(LdapManagerImpl, constructorArgs: [ldapConfigurationDao, ldapContextFactory, ldapUserManager])
         ldapManager.getUser(_) >> { new LdapUser("rmurphy", "rmurphy@test.com", "Ryan", "Murphy", "cn=rmurphy,dc=cloudstack,dc=org") }
-        when:
+	when: "The user attempts to authenticate with a bad password"
         def result = ldapManager.canAuthenticate("rmurphy", "password")
-        then:
-        result == false
+	then: "The authentication fails"
+	result == false
     }
 
-    def "Test successful result from canAuthenticate"() {
-        given:
-        def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
-        def ldapContextFactory = Mock(LdapContextFactory)
-        ldapContextFactory.createUserContext(_, _) >> null
-        def ldapUserManager = Mock(LdapUserManager)
-        def ldapManager = Spy(LdapManagerImpl, constructorArgs: [ldapConfigurationDao, ldapContextFactory, ldapUserManager])
-        ldapManager.getUser(_) >> { new LdapUser("rmurphy", "rmurphy@test.com", "Ryan", "Murphy", "cn=rmurphy,dc=cloudstack,dc=org") }
-        when:
-        def result = ldapManager.canAuthenticate("rmurphy", "password")
-        then:
-        result == true
+    def "Test successful failed result from canAuthenticate due to user not found"() {
+	given: "We have an LdapConfigurationDao, LdapContextFactory, LdapUserManager and LdapManager"
+	def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
+	def ldapContextFactory = Mock(LdapContextFactory)
+	def ldapUserManager = Mock(LdapUserManager)
+	def ldapManager = Spy(LdapManagerImpl, constructorArgs: [ldapConfigurationDao, ldapContextFactory, ldapUserManager])
+	ldapManager.getUser(_) >> { throw new NamingException() }
+	when: "The user attempts to authenticate and the user is not found"
+	def result = ldapManager.canAuthenticate("rmurphy", "password")
+	then: "the authentication fails"
+	result == false
     }
 
-    def "Test successful closing of context"() {
-        given:
-        def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
-        def ldapContextFactory = Mock(LdapContextFactory)
-        def ldapUserManager = Mock(LdapUserManager)
-        def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
-        when:
-        def context = Mock(InitialLdapContext)
-        ldapManager.closeContext(context)
-        then:
-        context.defaultInitCtx == null
+    def "Test successful failed result from deleteConfiguration due to configuration not existing"() {
+	given: "We have an LdapConfigurationDao, LdapContextFactory, LdapUserManager and LdapManager"
+	def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
+	def ldapContextFactory = Mock(LdapContextFactory)
+	def ldapUserManager = Mock(LdapUserManager)
+	ldapConfigurationDao.findByHostname(_) >> null
+	def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
+	when: "A ldap configuration that doesn't exist is deleted"
+	ldapManager.deleteConfiguration("localhost")
+	then: "A exception is thrown"
+	thrown InvalidParameterValueException
     }
 
     def "Test successful failing to close of context"() {
-        given:
+	given: "We have an LdapConfigurationDao, LdapContextFactory, LdapUserManager and LdapManager"
         def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
         def ldapContextFactory = Mock(LdapContextFactory)
         def ldapUserManager = Mock(LdapUserManager)
         def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
-        when:
+	when: "The context is closed"
         def context = Mock(InitialLdapContext)
         context.close() >> { throw new NamingException() }
         ldapManager.closeContext(context)
-        then:
-        context.defaultInitCtx == null
+	then: "An exception is thrown"
+	context.defaultInitCtx == null
     }
 
-    def "Test LdapConfigurationResponse generation"() {
-        given:
-        def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
-        def ldapContextFactory = Mock(LdapContextFactory)
-        def ldapUserManager = Mock(LdapUserManager)
-        def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
-        when:
-        def result = ldapManager.createLdapConfigurationResponse(new LdapConfigurationVO("localhost", 389))
-        then:
-        result.hostname == "localhost"
-        result.port == 389
+    def "Test successful result from canAuthenticate"() {
+	given: "We have an LdapConfigurationDao, LdapContextFactory, LdapUserManager and LdapManager"
+	def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
+	def ldapContextFactory = Mock(LdapContextFactory)
+	ldapContextFactory.createUserContext(_, _) >> null
+	def ldapUserManager = Mock(LdapUserManager)
+	def ldapManager = Spy(LdapManagerImpl, constructorArgs: [ldapConfigurationDao, ldapContextFactory, ldapUserManager])
+	ldapManager.getUser(_) >> { new LdapUser("rmurphy", "rmurphy@test.com", "Ryan", "Murphy", "cn=rmurphy,dc=cloudstack,dc=org") }
+	when: "A user authenticates"
+	def result = ldapManager.canAuthenticate("rmurphy", "password")
+	then: "The result is true"
+	result == true
     }
 
-    def "Test LdapUserResponse generation"() {
-        given:
-        def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
-        def ldapContextFactory = Mock(LdapContextFactory)
-        def ldapUserManager = Mock(LdapUserManager)
-        def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
-        when:
-        def result = ldapManager.createLdapUserResponse(new LdapUser("rmurphy", "rmurphy@test.com", "Ryan", "Murphy", "cn=rmurphy,dc=cloudstack,dc=org"))
-        then:
-        result.username == "rmurphy"
-        result.email == "rmurphy@test.com"
-        result.firstname == "Ryan"
-        result.lastname == "Murphy"
-        result.principal == "cn=rmurphy,dc=cloudstack,dc=org"
+    def "Test successful result from deleteConfiguration"() {
+	given: "We have an LdapConfigurationDao, LdapContextFactory, LdapUserManager and LdapManager"
+	def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
+	def ldapContextFactory = Mock(LdapContextFactory)
+	def ldapUserManager = Mock(LdapUserManager)
+	ldapConfigurationDao.findByHostname(_) >> {
+	    def configuration = new LdapConfigurationVO("localhost", 389)
+	    configuration.setId(0);
+	    return configuration;
+	}
+	ldapConfigurationDao.remove(_) >> null
+	def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
+	when: "A ldap configuration is deleted"
+	def result = ldapManager.deleteConfiguration("localhost")
+	then: "The deleted configuration is returned"
+	result.hostname == "localhost"
+	result.port == 389
     }
 
-    def "Test that getCommands isn't empty"() {
-        given:
-        def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
-        def ldapContextFactory = Mock(LdapContextFactory)
-        def ldapUserManager = Mock(LdapUserManager)
-        def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
-        when:
-        def result = ldapManager.getCommands()
-        then:
-        result.size() > 0
+    def "Test successful result from searchUsers"() {
+	given: "We have an LdapConfigurationDao, LdapContextFactory, LdapUserManager and LdapManager"
+	def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
+	def ldapContextFactory = Mock(LdapContextFactory)
+	def ldapUserManager = Mock(LdapUserManager)
+	ldapContextFactory.createBindContext() >> null;
+
+	List<LdapUser> users = new ArrayList<LdapUser>();
+	users.add(new LdapUser("rmurphy", "rmurphy@test.com", "Ryan", "Murphy", "cn=rmurphy,dc=cloudstack,dc=org"))
+	ldapUserManager.getUsers(_, _) >> users;
+
+	def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
+	when: "We search for users"
+	def result = ldapManager.searchUsers("rmurphy");
+	then: "A list of atleast 1 is returned"
+	result.size() > 0;
     }
 
-    def "Test failing of getUser due to bind issue"() {
-        given:
-        def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
-        def ldapContextFactory = Mock(LdapContextFactory)
-        def ldapUserManager = Mock(LdapUserManager)
-        ldapContextFactory.createBindContext() >> { throw new NamingException() }
-        def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
-        when:
-        ldapManager.getUser("rmurphy")
-        then:
-        thrown NamingException
+    def "Test successfully addConfiguration"() {
+	given: "We have an LdapConfigurationDao, LdapContextFactory, LdapUserManager and LdapManager"
+	def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
+	def ldapContextFactory = Mock(LdapContextFactory)
+	def ldapUserManager = Mock(LdapUserManager)
+	ldapContextFactory.createBindContext(_) >> null
+	ldapConfigurationDao.persist(_) >> null
+	def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
+	when: "A ldap configuration is added"
+	def result = ldapManager.addConfiguration("localhost", 389)
+	then: "the resulting object contain the given hostname and port"
+	result.hostname == "localhost"
+	result.port == 389
     }
 
-    def "Test success of getUser"() {
-        given:
-        def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
-        def ldapContextFactory = Mock(LdapContextFactory)
-        def ldapUserManager = Mock(LdapUserManager)
-        ldapContextFactory.createBindContext() >> null
-        ldapUserManager.getUser(_, _) >> new LdapUser("rmurphy", "rmurphy@test.com", "Ryan", "Murphy", "cn=rmurphy,dc=cloudstack,dc=org")
-        def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
-        when:
-        def result = ldapManager.getUser("rmurphy")
-        then:
-        result.username == "rmurphy"
-        result.email == "rmurphy@test.com"
-        result.firstname == "Ryan"
-        result.lastname == "Murphy"
-        result.principal == "cn=rmurphy,dc=cloudstack,dc=org"
+    def "Test that addConfiguration fails when a binding fails"() {
+	given: "We have an LdapConfigurationDao, LdapContextFactory, LdapUserManager and LdapManager"
+	def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
+	def ldapContextFactory = Mock(LdapContextFactory)
+	def ldapUserManager = Mock(LdapUserManager)
+	ldapContextFactory.createBindContext(_) >> { throw new NamingException() }
+	def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
+	when: "A configuration is added that can not be binded"
+	ldapManager.addConfiguration("localhost", 389)
+	then: "An exception is thrown"
+	thrown InvalidParameterValueException
     }
 
-    def "Test failing of getUsers due to bind issue"() {
-        given:
-        def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
-        def ldapContextFactory = Mock(LdapContextFactory)
-        def ldapUserManager = Mock(LdapUserManager)
-        ldapContextFactory.createBindContext() >> { throw new NamingException() }
-        def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
-        when:
-        ldapManager.getUsers()
-        then:
-        thrown NoLdapUserMatchingQueryException
+    def "Test that addConfiguration fails when a duplicate configuration exists"() {
+	given: "We have an LdapConfigurationDao, LdapContextFactory, LdapUserManager and LdapManager"
+	def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
+	def ldapContextFactory = Mock(LdapContextFactory)
+	def ldapUserManager = Mock(LdapUserManager)
+	ldapConfigurationDao.findByHostname(_) >> new LdapConfigurationVO("localhost", 389)
+	def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
+	when: "a configuration that already exists is added"
+	ldapManager.addConfiguration("localhost", 389)
+	then: "An exception is thrown"
+	thrown InvalidParameterValueException
     }
 
-    def "Test success getUsers"() {
-        given:
-        def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
-        def ldapContextFactory = Mock(LdapContextFactory)
-        def ldapUserManager = Mock(LdapUserManager)
-        ldapContextFactory.createBindContext() >> null
-        List<LdapUser> users = new ArrayList<>();
-        users.add(new LdapUser("rmurphy", "rmurphy@test.com", "Ryan", "Murphy", "cn=rmurphy,dc=cloudstack,dc=org"))
-        ldapUserManager.getUsers(_) >> users;
-        def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
-        when:
-        def result = ldapManager.getUsers()
-        then:
-        result.size() > 0;
+    def "Test that getCommands isn't empty"() {
+	given: "We have an LdapConfigurationDao, LdapContextFactory, LdapUserManager and LdapManager"
+	def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
+	def ldapContextFactory = Mock(LdapContextFactory)
+	def ldapUserManager = Mock(LdapUserManager)
+	def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
+	when: "Get commands is called"
+	def result = ldapManager.getCommands()
+	then: "it must have atleast 1 command"
+	result.size() > 0
     }
 
-    def "Testing of listConfigurations"() {
+    def "Testing of isLdapEnabled"() {
+		given:
+		def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
+		def ldapContextFactory = Mock(LdapContextFactory)
+		def ldapUserManager = Mock(LdapUserManager)
+		List<LdapConfigurationVO> ldapConfigurationList = new ArrayList()
+		ldapConfigurationList.add(new LdapConfigurationVO("localhost", 389))
+		Pair<List<LdapConfigurationVO>, Integer> configurations = new Pair<List<LdapConfigurationVO>, Integer>();
+		configurations.set(ldapConfigurationList, ldapConfigurationList.size())
+		ldapConfigurationDao.searchConfigurations(_, _) >> configurations
+		def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
+		when:
+		def result = ldapManager.isLdapEnabled();
+		then:
+		result == true;
+	}
+
+	def "Testing of listConfigurations"() {
         given:
         def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
         def ldapContextFactory = Mock(LdapContextFactory)
@@ -282,38 +321,7 @@ class LdapManagerImplSpec extends spock.lang.Specification {
         def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
         when:
         def result = ldapManager.listConfigurations(new LdapListConfigurationCmd())
-        then:
-        result.second() > 0
-    }
-
-    def "Test failing of searchUsers due to a failure to bind"() {
-        given:
-        def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
-        def ldapContextFactory = Mock(LdapContextFactory)
-        def ldapUserManager = Mock(LdapUserManager)
-        ldapContextFactory.createBindContext() >> { throw new NamingException() }
-        def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
-        when:
-        ldapManager.searchUsers("rmurphy")
-        then:
-        thrown NoLdapUserMatchingQueryException
-    }
-
-    def "Test successful result from searchUsers"() {
-        given:
-        def ldapConfigurationDao = Mock(LdapConfigurationDaoImpl)
-        def ldapContextFactory = Mock(LdapContextFactory)
-        def ldapUserManager = Mock(LdapUserManager)
-        ldapContextFactory.createBindContext() >> null;
-
-        List<LdapUser> users = new ArrayList<LdapUser>();
-        users.add(new LdapUser("rmurphy", "rmurphy@test.com", "Ryan", "Murphy", "cn=rmurphy,dc=cloudstack,dc=org"))
-        ldapUserManager.getUsers(_, _) >> users;
-
-        def ldapManager = new LdapManagerImpl(ldapConfigurationDao, ldapContextFactory, ldapUserManager)
-        when:
-        def result = ldapManager.searchUsers("rmurphy");
-        then:
-        result.size() > 0;
+	then:
+	result.second() > 0
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25e8e9b8/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapSearchUserCmdSpec.groovy
----------------------------------------------------------------------
diff --git a/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapSearchUserCmdSpec.groovy b/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapSearchUserCmdSpec.groovy
index b23d7c2..4bc5ca8 100644
--- a/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapSearchUserCmdSpec.groovy
+++ b/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapSearchUserCmdSpec.groovy
@@ -16,27 +16,16 @@
 // under the License.
 package groovy.org.apache.cloudstack.ldap
 
-import org.apache.cloudstack.api.ServerApiException
-import org.apache.cloudstack.api.command.LdapUserSearchCmd
-import org.apache.cloudstack.api.response.LdapUserResponse
-import org.apache.cloudstack.ldap.LdapManager
-import org.apache.cloudstack.ldap.LdapUser
-import org.apache.cloudstack.ldap.NoLdapUserMatchingQueryException
 
 class LdapSearchUserCmdSpec extends spock.lang.Specification {
-    def "Test successful response from execute"() {
+    def "Test getEntityOwnerId is 1"() {
         given:
         def ldapManager = Mock(LdapManager)
-        List<LdapUser> users = new ArrayList()
-        users.add(new LdapUser("rmurphy", "rmurphy@test.com", "Ryan", "Murphy", "cn=rmurphy,dc=cloudstack,dc=org"))
-        ldapManager.searchUsers(_) >> users
-        LdapUserResponse response = new LdapUserResponse("rmurphy", "rmurphy@test.com", "Ryan", "Murphy", "cn=rmurphy,dc=cloudstack,dc=org")
-        ldapManager.createLdapUserResponse(_) >> response
         def ldapUserSearchCmd = new LdapUserSearchCmd(ldapManager)
         when:
-        ldapUserSearchCmd.execute()
+	long ownerId = ldapUserSearchCmd.getEntityOwnerId()
         then:
-        ldapUserSearchCmd.responseObject.getResponses().size() != 0
+	ownerId == 1
     }
 
     def "Test successful empty response from execute"() {
@@ -50,14 +39,19 @@ class LdapSearchUserCmdSpec extends spock.lang.Specification {
         ldapUserSearchCmd.responseObject.getResponses().size() == 0
     }
 
-    def "Test getEntityOwnerId is 0"() {
+    def "Test successful response from execute"() {
         given:
         def ldapManager = Mock(LdapManager)
+	List<LdapUser> users = new ArrayList()
+	users.add(new LdapUser("rmurphy", "rmurphy@test.com", "Ryan", "Murphy", "cn=rmurphy,dc=cloudstack,dc=org"))
+	ldapManager.searchUsers(_) >> users
+	LdapUserResponse response = new LdapUserResponse("rmurphy", "rmurphy@test.com", "Ryan", "Murphy", "cn=rmurphy,dc=cloudstack,dc=org")
+	ldapManager.createLdapUserResponse(_) >> response
         def ldapUserSearchCmd = new LdapUserSearchCmd(ldapManager)
         when:
-        long ownerId = ldapUserSearchCmd.getEntityOwnerId()
+	ldapUserSearchCmd.execute()
         then:
-        ownerId == 1
+	ldapUserSearchCmd.responseObject.getResponses().size() != 0
     }
 
     def "Test successful return of getCommandName"() {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25e8e9b8/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapUserManagerSpec.groovy
----------------------------------------------------------------------
diff --git a/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapUserManagerSpec.groovy b/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapUserManagerSpec.groovy
index 2d31aa6..d13f0e8 100644
--- a/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapUserManagerSpec.groovy
+++ b/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapUserManagerSpec.groovy
@@ -16,16 +16,10 @@
 // under the License.
 package groovy.org.apache.cloudstack.ldap
 
-import org.apache.cloudstack.ldap.LdapConfiguration
-import org.apache.cloudstack.ldap.LdapUserManager
-import spock.lang.Shared
+import javax.naming.directory.Attributes;
+import javax.naming.directory.SearchResult;
 
-import javax.naming.NamingException
-import javax.naming.directory.Attribute
-import javax.naming.directory.Attributes
-import javax.naming.directory.SearchControls
-import javax.naming.directory.SearchResult
-import javax.naming.ldap.LdapContext
+import spock.lang.Shared;
 
 class LdapUserManagerSpec extends spock.lang.Specification {
 
@@ -47,6 +41,55 @@ class LdapUserManagerSpec extends spock.lang.Specification {
     @Shared
     private def principal
 
+    private def createContext() {
+
+	Attributes attributes = createUserAttributes(username, email, firstname, lastname)
+	SearchResult searchResults = createSearchResult(attributes)
+	def searchUsersResults = new BasicNamingEnumerationImpl()
+	searchUsersResults.add(searchResults);
+
+	def context = Mock(LdapContext)
+	context.search(_, _, _) >> searchUsersResults;
+
+	return context
+    }
+
+    private SearchResult createSearchResult(attributes) {
+	def search = Mock(SearchResult)
+
+	search.getName() >> "cn=" + attributes.getAt("uid").get();
+
+	search.getAttributes() >> attributes
+
+	return search
+    }
+
+    private Attributes createUserAttributes(String username, String email, String firstname, String lastname) {
+	def attributes = Mock(Attributes)
+
+	def nameAttribute = Mock(Attribute)
+	nameAttribute.getId() >> "uid"
+	nameAttribute.get() >> username
+	attributes.get("uid") >> nameAttribute
+
+	def mailAttribute = Mock(Attribute)
+	mailAttribute.getId() >> "mail"
+	mailAttribute.get() >> email
+	attributes.get("mail") >> mailAttribute
+
+	def givennameAttribute = Mock(Attribute)
+	givennameAttribute.getId() >> "givenname"
+	givennameAttribute.get() >> firstname
+	attributes.get("givenname") >> givennameAttribute
+
+	def snAttribute = Mock(Attribute)
+	snAttribute.getId() >> "sn"
+	snAttribute.get() >> lastname
+	attributes.get("sn") >> snAttribute
+
+	return attributes
+    }
+
     def setupSpec() {
         ldapConfiguration = Mock(LdapConfiguration)
 
@@ -62,146 +105,97 @@ class LdapUserManagerSpec extends spock.lang.Specification {
         email = "rmurphy@test.com"
         firstname = "Ryan"
         lastname = "Murphy"
-        principal = "cn=" + username + "," + ldapConfiguration.getBaseDn()
-    }
-
-    def "Test that a newly created Ldap User Manager is not null"() {
-        given: "You have created a new Ldap user manager object"
-        def result = new LdapUserManager();
-        expect: "The result is not null"
-        result != null
+	principal = "cn=" + username + "," + ldapConfiguration.getBaseDn()
     }
 
     def "Test successfully creating an Ldap User from Search result"() {
-        given:
-        def attributes = createUserAttributes(username, email, firstname, lastname)
+	given: "We have attributes, a search and a user manager"
+	def attributes = createUserAttributes(username, email, firstname, lastname)
         def search = createSearchResult(attributes)
         def userManager = new LdapUserManager(ldapConfiguration)
         def result = userManager.createUser(search)
 
-        expect:
-
-        result.username == username
-        result.email == email
-        result.firstname == firstname
-        result.lastname == lastname
-        result.principal == principal
-    }
-
-    def "Test successfully returning an Ldap user from a get user request"() {
-        given:
+	expect: "The crated user the data supplied from LDAP"
 
-        def userManager = new LdapUserManager(ldapConfiguration)
-
-        when:
-        def result = userManager.getUser(username, createContext())
-
-        then:
         result.username == username
         result.email == email
         result.firstname == firstname
         result.lastname == lastname
-        result.principal == principal
+	result.principal == principal
     }
 
     def "Test successfully returning a list from get users"() {
-        given:
+	given: "We have a LdapUserManager"
 
         def userManager = new LdapUserManager(ldapConfiguration)
 
-        when:
+	when: "A request for users is made"
         def result = userManager.getUsers(username, createContext())
 
-        then:
+	then: "A list of users is returned"
         result.size() == 1
     }
 
     def "Test successfully returning a list from get users when no username is given"() {
-        given:
+	given: "We have a LdapUserManager"
 
         def userManager = new LdapUserManager(ldapConfiguration)
 
-        when:
+	when: "Get users is called without a username"
         def result = userManager.getUsers(createContext())
 
-        then:
-        result.size() == 1
-    }
-
-    def "Test successfully throwing an exception when no users are found with getUser"() {
-        given:
-
-        def searchUsersResults = new BasicNamingEnumerationImpl()
-
-        def context = Mock(LdapContext)
-        context.search(_, _, _) >> searchUsersResults;
-
-        def userManager = new LdapUserManager(ldapConfiguration)
-
-        when:
-        def result = userManager.getUser(username, context)
-
-        then:
-        thrown NamingException
+	then: "All users are returned"
+	result.size() == 1
     }
 
     def "Test successfully returning a NamingEnumeration from searchUsers"() {
-        given:
-        def userManager = new LdapUserManager(ldapConfiguration)
+	given: "We have a LdapUserManager"
+	def userManager = new LdapUserManager(ldapConfiguration)
 
-        when:
+	when: "We search for users"
         def result = userManager.searchUsers(createContext())
 
-        then:
+	then: "A list of users are returned."
         result.next().getName() + "," + ldapConfiguration.getBaseDn() == principal
     }
 
-    private def createContext() {
+    def "Test successfully returning an Ldap user from a get user request"() {
+	given: "We have a LdapUserMaanger"
 
-        Attributes attributes = createUserAttributes(username, email, firstname, lastname)
-        SearchResult searchResults = createSearchResult(attributes)
-        def searchUsersResults = new BasicNamingEnumerationImpl()
-        searchUsersResults.add(searchResults);
+	def userManager = new LdapUserManager(ldapConfiguration)
 
-        def context = Mock(LdapContext)
-        context.search(_, _, _) >> searchUsersResults;
+	when: "A request for a user is made"
+	def result = userManager.getUser(username, createContext())
 
-        return context
+	then: "The user is returned"
+	result.username == username
+	result.email == email
+	result.firstname == firstname
+	result.lastname == lastname
+	result.principal == principal
     }
 
-    private SearchResult createSearchResult(attributes) {
-        def search = Mock(SearchResult)
-
-        search.getName() >> "cn=" + attributes.getAt("uid").get();
-
-        search.getAttributes() >> attributes
+    def "Test successfully throwing an exception when no users are found with getUser"() {
+	given: "We have a seachResult of users and a User Manager"
 
-        return search
-    }
+	def searchUsersResults = new BasicNamingEnumerationImpl()
 
-    private Attributes createUserAttributes(String username, String email, String firstname, String lastname) {
-        def attributes = Mock(Attributes)
+	def context = Mock(LdapContext)
+	context.search(_, _, _) >> searchUsersResults;
 
-        def nameAttribute = Mock(Attribute)
-        nameAttribute.getId() >> "uid"
-        nameAttribute.get() >> username
-        attributes.get("uid") >> nameAttribute
+	def userManager = new LdapUserManager(ldapConfiguration)
 
-        def mailAttribute = Mock(Attribute)
-        mailAttribute.getId() >> "mail"
-        mailAttribute.get() >> email
-        attributes.get("mail") >> mailAttribute
+	when: "a get user request is made and no user is found"
+	def result = userManager.getUser(username, context)
 
-        def givennameAttribute = Mock(Attribute)
-        givennameAttribute.getId() >> "givenname"
-        givennameAttribute.get() >> firstname
-        attributes.get("givenname") >> givennameAttribute
-
-        def snAttribute = Mock(Attribute)
-        snAttribute.getId() >> "sn"
-        snAttribute.get() >> lastname
-        attributes.get("sn") >> snAttribute
+	then: "An exception is thrown."
+	thrown NamingException
+    }
 
-        return attributes
+    def "Test that a newly created Ldap User Manager is not null"() {
+	given: "You have created a new Ldap user manager object"
+	def result = new LdapUserManager();
+	expect: "The result is not null"
+	result != null
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25e8e9b8/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapUserResponseSpec.groovy
----------------------------------------------------------------------
diff --git a/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapUserResponseSpec.groovy b/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapUserResponseSpec.groovy
index aa7d5a3..2389a9d 100644
--- a/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapUserResponseSpec.groovy
+++ b/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapUserResponseSpec.groovy
@@ -16,52 +16,51 @@
 // under the License.
 package groovy.org.apache.cloudstack.ldap
 
-import org.apache.cloudstack.api.response.LdapUserResponse
 
 
 class LdapUserResponseSpec extends spock.lang.Specification {
     def "Testing succcessful setting of LdapUserResponse email"() {
-        given:
+	given: "We have an LdapResponse"
         LdapUserResponse response = new LdapUserResponse();
-        when:
+	when: "An email address is set"
         response.setEmail("rmurphy@test.com");
-        then:
-        response.getEmail() == "rmurphy@test.com";
-    }
-
-    def "Testing successful setting of LdapUserResponse principal"() {
-        given:
-        LdapUserResponse response = new LdapUserResponse()
-        when:
-        response.setPrincipal("dc=cloudstack,dc=org")
-        then:
-        response.getPrincipal() == "dc=cloudstack,dc=org"
-    }
-
-    def "Testing successful setting of LdapUserResponse username"() {
-        given:
-        LdapUserResponse response = new LdapUserResponse()
-        when:
-        response.setUsername("rmurphy")
-        then:
-        response.getUsername() == "rmurphy"
+	then: "Get email should return that set email"
+	response.getEmail() == "rmurphy@test.com";
     }
 
     def "Testing successful setting of LdapUserResponse firstname"() {
-        given:
-        LdapUserResponse response = new LdapUserResponse()
-        when:
+	given: "We have an LdapUserResponse"
+	LdapUserResponse response = new LdapUserResponse()
+	when: "A firstname is set"
         response.setFirstname("Ryan")
-        then:
+	then: "gGet Firstname returns the set value"
         response.getFirstname() == "Ryan"
     }
 
     def "Testing successful setting of LdapUserResponse lastname"() {
-        given:
+	given: "We have an LdapUserResponse"
         LdapUserResponse response = new LdapUserResponse()
-        when:
+	when: "A lastname is set"
         response.setLastname("Murphy")
-        then:
-        response.getLastname() == "Murphy"
+	then: "Get lastname is returned"
+	response.getLastname() == "Murphy"
+    }
+
+    def "Testing successful setting of LdapUserResponse principal"() {
+	given: "We have an LdapResponse"
+	LdapUserResponse response = new LdapUserResponse()
+	when: "A principal is set"
+	response.setPrincipal("dc=cloudstack,dc=org")
+	then: "Get principled returns the set value"
+	response.getPrincipal() == "dc=cloudstack,dc=org"
+    }
+
+    def "Testing successful setting of LdapUserResponse username"() {
+	given: "We have an LdapUserResponse"
+	LdapUserResponse response = new LdapUserResponse()
+	when: "A username is set"
+	response.setUsername("rmurphy")
+	then: "Get username returns the set value."
+	response.getUsername() == "rmurphy"
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25e8e9b8/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapUserSpec.groovy
----------------------------------------------------------------------
diff --git a/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapUserSpec.groovy b/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapUserSpec.groovy
index 5519d7f..6510352 100644
--- a/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapUserSpec.groovy
+++ b/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapUserSpec.groovy
@@ -16,10 +16,43 @@
 // under the License.
 package groovy.org.apache.cloudstack.ldap
 
-import org.apache.cloudstack.ldap.LdapUser
 
 class LdapUserSpec extends spock.lang.Specification {
 
+    def "Testing LdapUsers hashCode generation"() {
+	given:
+	def userA = new LdapUser(usernameA, "", "", "", "")
+	expect:
+	userA.hashCode() == usernameA.hashCode()
+	where:
+	usernameA = "A"
+    }
+
+    def "Testing that LdapUser successfully gives the correct result for a compare to"() {
+	given: "You have created two LDAP user objects"
+	def userA = new LdapUser(usernameA, "", "", "", "")
+	def userB = new LdapUser(usernameB, "", "", "", "")
+	expect: "That when compared the result is less than or equal to 0"
+	userA.compareTo(userB) <= 0
+	where: "The following values are used"
+	usernameA | usernameB
+	"A"       | "B"
+	"A"       | "A"
+    }
+
+    def "Testing that LdapUsers equality"() {
+	given:
+	def userA = new LdapUser(usernameA, "", "", "", "")
+	def userB = new LdapUser(usernameB, "", "", "", "")
+	expect:
+	userA.equals(userA) == true
+	userA.equals(new Object()) == false
+	userA.equals(userB) == false
+	where:
+	usernameA | usernameB
+	"A"       | "B"
+    }
+
     def "Testing that the username is correctly set with the ldap object"() {
         given: "You have created a LDAP user object with a username"
         def user = new LdapUser(username, "", "", "","")
@@ -64,38 +97,4 @@ class LdapUserSpec extends spock.lang.Specification {
         where: "The username is set to "
         principal << ["", null, "cn=rmurphy,dc=cloudstack,dc=org"]
     }
-
-    def "Testing that LdapUser successfully gives the correct result for a compare to"() {
-        given: "You have created two LDAP user objects"
-        def userA = new LdapUser(usernameA, "", "", "", "")
-        def userB = new LdapUser(usernameB, "", "", "", "")
-        expect: "That when compared the result is less than or equal to 0"
-        userA.compareTo(userB) <= 0
-        where: "The following values are used"
-        usernameA | usernameB
-        "A"       | "B"
-        "A"       | "A"
-    }
-
-    def "Testing that LdapUsers equality"() {
-	given:
-	def userA = new LdapUser(usernameA, "", "", "", "")
-	def userB = new LdapUser(usernameB, "", "", "", "")
-	expect:
-	userA.equals(userA) == true
-	userA.equals(new Object()) == false
-	userA.equals(userB) == false
-	where:
-	usernameA | usernameB
-	"A"       | "B"
-    }
-
-    def "Testing LdapUsers hashCode generation"() {
-	given:
-	def userA = new LdapUser(usernameA, "", "", "", "")
-	expect:
-	userA.hashCode() == usernameA.hashCode()
-	where:
-	usernameA = "A"
-    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25e8e9b8/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapUtilsSpec.groovy
----------------------------------------------------------------------
diff --git a/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapUtilsSpec.groovy b/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapUtilsSpec.groovy
index 7fc05a9..1825c39 100644
--- a/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapUtilsSpec.groovy
+++ b/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/LdapUtilsSpec.groovy
@@ -16,22 +16,18 @@
 // under the License.
 package groovy.org.apache.cloudstack.ldap
 
-import org.apache.cloudstack.ldap.LdapUtils
-
-import javax.naming.directory.Attribute
-import javax.naming.directory.Attributes
 
 class LdapUtilsSpec extends spock.lang.Specification {
-    def "Testing that a Ldap Search Filter is correctly escaped"() {
-        given: "You have some input from a user"
+    def "Testing than an attribute is not successfully returned"() {
+	given: "You have an attributes object with some attribute"
+	def attributes = Mock(Attributes)
+	attributes.get("uid") >> null
 
-        expect: "That the input is escaped"
-        LdapUtils.escapeLDAPSearchFilter(input) == result
+	when: "You get the attribute"
+	String foundValue = LdapUtils.getAttributeValue(attributes, "uid")
 
-        where: "The following inputs are given "
-        input                                       | result
-        "Hi This is a test #çà"                     | "Hi This is a test #çà"
-        "Hi (This) = is * a \\ test # ç à ô \u0000" | "Hi \\28This\\29 = is \\2a a \\5c test # ç à ô \\00"
+	then: "Its value equals uid"
+	foundValue == null
     }
 
     def "Testing than an attribute is successfully returned"() {
@@ -54,15 +50,15 @@ class LdapUtilsSpec extends spock.lang.Specification {
         "email" | "rmurphy@test.com"
     }
 
-    def "Testing than an attribute is not successfully returned"() {
-        given: "You have an attributes object with some attribute"
-        def attributes = Mock(Attributes)
-        attributes.get("uid") >> null
+    def "Testing that a Ldap Search Filter is correctly escaped"() {
+	given: "You have some input from a user"
 
-        when: "You get the attribute"
-        String foundValue = LdapUtils.getAttributeValue(attributes, "uid")
+	expect: "That the input is escaped"
+	LdapUtils.escapeLDAPSearchFilter(input) == result
 
-        then: "Its value equals uid"
-        foundValue == null
+	where: "The following inputs are given "
+	input                                       | result
+	"Hi This is a test #çà"                     | "Hi This is a test #çà"
+	"Hi (This) = is * a \\ test # ç à ô \u0000" | "Hi \\28This\\29 = is \\2a a \\5c test # ç à ô \\00"
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25e8e9b8/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/NoLdapUserMatchingQueryExceptionSpec.groovy
----------------------------------------------------------------------
diff --git a/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/NoLdapUserMatchingQueryExceptionSpec.groovy b/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/NoLdapUserMatchingQueryExceptionSpec.groovy
index 4c0cc4b..a301012 100644
--- a/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/NoLdapUserMatchingQueryExceptionSpec.groovy
+++ b/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/NoLdapUserMatchingQueryExceptionSpec.groovy
@@ -16,7 +16,6 @@
 // under the License.
 package groovy.org.apache.cloudstack.ldap
 
-import org.apache.cloudstack.ldap.NoLdapUserMatchingQueryException
 
 class NoLdapUserMatchingQueryExceptionSpec extends spock.lang.Specification {
     def "Test that the query is correctly set within the No LDAP user matching query exception object"() {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25e8e9b8/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/NoSuchLdapUserExceptionSpec.groovy
----------------------------------------------------------------------
diff --git a/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/NoSuchLdapUserExceptionSpec.groovy b/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/NoSuchLdapUserExceptionSpec.groovy
index dbdf646..84cc908 100644
--- a/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/NoSuchLdapUserExceptionSpec.groovy
+++ b/plugins/user-authenticators/ldap/test/groovy/org/apache/cloudstack/ldap/NoSuchLdapUserExceptionSpec.groovy
@@ -16,7 +16,6 @@
 // under the License.
 package groovy.org.apache.cloudstack.ldap
 
-import org.apache.cloudstack.ldap.NoSuchLdapUserException;
 
 class NoSuchLdapUserExceptionSpec extends spock.lang.Specification {
     def "Test that the username is correctly set within the No such LDAP user exception object"() {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25e8e9b8/server/src/com/cloud/configuration/Config.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java
index bc60d6c..8fc2637 100755
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -424,7 +424,7 @@ public enum Config {
     // object store
     S3EnableRRS("Advanced", ManagementServer.class, Boolean.class, "s3.rrs.enabled", "false", "enable s3 reduced redundancy storage", null),
 
-        // Ldap
+    // Ldap
     LdapBasedn("Advanced", ManagementServer.class, String.class, "ldap.basedn", null, "Sets the basedn for LDAP", null),
     LdapBindPassword("Advanced", ManagementServer.class, String.class, "ldap.bind.password", null, "Sets the bind password for LDAP", null),
     LdapBindPrincipal("Advanced", ManagementServer.class, String.class, "ldap.bind.principal", null, "Sets the bind principal for LDAP", null),
@@ -434,7 +434,6 @@ public enum Config {
     LdapUsernameAttribute("Advanced", ManagementServer.class, String.class, "ldap.username.attribute", "uid", "Sets the username attribute used within LDAP", null),
     LdapUserObject("Advanced", ManagementServer.class, String.class, "ldap.user.object", "inetOrgPerson", "Sets the object type of users within LDAP", null),
     LdapSearchGroupPrinciple("Advanced", ManagementServer.class, String.class, "ldap.search.group.principle", null, "Sets the principle of the group that users must be a member of", null),
-    LdapSSLEnabled("Advanced", ManagementServer.class, String.class, "ldap.ssl.enabled", "false", "Enables/Disables SSL support for LDAP", null),
     LdapTrustStore("Advanced", ManagementServer.class, String.class, "ldap.truststore", null, "Sets the path to the truststore to use for SSL", null),
     LdapTrustStorePassword("Advanced", ManagementServer.class, String.class, "ldap.truststore.password", null, "Sets the password for the truststore", null),
 
@@ -446,15 +445,15 @@ public enum Config {
 
     BlacklistedRoutes("Advanced", VpcManager.class, String.class, "blacklisted.routes", null, "Routes that are blacklisted, can not be used for Static Routes creation for the VPC Private Gateway",
 	           "routes", ConfigurationParameterScope.zone.toString()),
-	
+
     InternalLbVmServiceOfferingId("Advanced", ManagementServer.class, String.class, "internallbvm.service.offering", null, "Uuid of the service offering used by internal lb vm; if NULL - default system internal lb offering will be used", null),
     ExecuteInSequence("Advanced", ManagementServer.class, Boolean.class, "execute.in.sequence.hypervisor.commands", "false", "If set to true, StartCommand, StopCommand, CopyCommand will be synchronized on the agent side." +
     		" If set to false, these commands become asynchronous. Default value is false.", null),
-    ExecuteInSequenceNetworkElementCommands("Advanced", NetworkManager.class, Boolean.class, "execute.in.sequence.network.element.commands", "false", "If set to true, DhcpEntryCommand, SavePasswordCommand, UserDataCommand, VmDataCommand will be synchronized on the agent side." + 
+    ExecuteInSequenceNetworkElementCommands("Advanced", NetworkManager.class, Boolean.class, "execute.in.sequence.network.element.commands", "false", "If set to true, DhcpEntryCommand, SavePasswordCommand, UserDataCommand, VmDataCommand will be synchronized on the agent side." +
             " If set to false, these commands become asynchronous. Default value is false.", null),
-	
+
 	UCSSyncBladeInterval("Advanced", ManagementServer.class, Integer.class, "ucs.sync.blade.interval", "3600", "the interval cloudstack sync with UCS manager for available blades in case user remove blades from chassis without notifying CloudStack", null);
-	
+
 	private final String _category;
 	private final Class<?> _componentClass;
 	private final Class<?> _type;
@@ -630,4 +629,4 @@ public enum Config {
     public static List<Config> getConfigListByScope(String scope) {
         return _scopeLevelConfigsMap.get(scope);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25e8e9b8/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql
index 5277258..43c6c74 100644
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@ -98,7 +98,7 @@ CREATE TABLE `cloud`.`image_store` (
   `uuid` varchar(255) COMMENT 'uuid of data store',
   `parent` varchar(255) COMMENT 'parent path for the storage server',
   `created` datetime COMMENT 'date the image store first signed on',
-  `removed` datetime COMMENT 'date removed if not null',  
+  `removed` datetime COMMENT 'date removed if not null',
   `total_size` bigint unsigned COMMENT 'storage total size statistics',
   `used_bytes` bigint unsigned COMMENT 'storage available bytes statistics',
   PRIMARY KEY(`id`)
@@ -116,7 +116,7 @@ CREATE TABLE `cloud`.`image_store_details` (
 
 DROP VIEW IF EXISTS `cloud`.`image_store_view`;
 CREATE VIEW `cloud`.`image_store_view` AS
-    select 
+    select
         image_store.id,
         image_store.uuid,
         image_store.name,
@@ -138,9 +138,9 @@ CREATE VIEW `cloud`.`image_store_view` AS
             left join
         `cloud`.`image_store_details` ON image_store_details.store_id = image_store.id;
 
-            
+
 -- here we have to allow null for store_id to accomodate baremetal case to search for ready templates since template state is only stored in this table
--- FK also commented out due to this            
+-- FK also commented out due to this
 CREATE TABLE  `cloud`.`template_store_ref` (
   `id` bigint unsigned NOT NULL auto_increment,
   `store_id` bigint unsigned,
@@ -150,7 +150,7 @@ CREATE TABLE  `cloud`.`template_store_ref` (
   `job_id` varchar(255),
   `download_pct` int(10) unsigned,
   `size` bigint unsigned,
-  `store_role` varchar(255),  
+  `store_role` varchar(255),
   `physical_size` bigint unsigned DEFAULT 0,
   `download_state` varchar(255),
   `error_str` varchar(255),
@@ -162,7 +162,7 @@ CREATE TABLE  `cloud`.`template_store_ref` (
   `is_copy` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates whether this was copied ',
   `update_count` bigint unsigned,
   `ref_cnt` bigint unsigned DEFAULT 0,
-  `updated` datetime, 
+  `updated` datetime,
   PRIMARY KEY  (`id`),
 --  CONSTRAINT `fk_template_store_ref__store_id` FOREIGN KEY `fk_template_store_ref__store_id` (`store_id`) REFERENCES `image_store` (`id`) ON DELETE CASCADE,
   INDEX `i_template_store_ref__store_id`(`store_id`),
@@ -178,7 +178,7 @@ CREATE TABLE  `cloud`.`template_store_ref` (
 -- ALTER TABLE `cloud`.`snapshots` DROP COLUMN `sechost_id`;
 
 -- change upload host_id FK to point to image_store table
-ALTER TABLE `cloud`.`upload` DROP FOREIGN KEY `fk_upload__host_id`; 
+ALTER TABLE `cloud`.`upload` DROP FOREIGN KEY `fk_upload__host_id`;
 ALTER TABLE `cloud`.`upload` ADD CONSTRAINT `fk_upload__store_id` FOREIGN KEY(`host_id`) REFERENCES `image_store` (`id`) ON DELETE CASCADE;
 
 CREATE TABLE  `cloud`.`snapshot_store_ref` (
@@ -193,11 +193,11 @@ CREATE TABLE  `cloud`.`snapshot_store_ref` (
   `physical_size` bigint unsigned DEFAULT 0,
   `parent_snapshot_id` bigint unsigned DEFAULT 0,
   `install_path` varchar(255),
-  `state` varchar(255) NOT NULL,  
-  -- `removed` datetime COMMENT 'date removed if not null',  
+  `state` varchar(255) NOT NULL,
+  -- `removed` datetime COMMENT 'date removed if not null',
   `update_count` bigint unsigned,
   `ref_cnt` bigint unsigned,
-  `updated` datetime,   
+  `updated` datetime,
   `volume_id` bigint unsigned,
   PRIMARY KEY  (`id`),
   INDEX `i_snapshot_store_ref__store_id`(`store_id`),
@@ -222,11 +222,11 @@ CREATE TABLE  `cloud`.`volume_store_ref` (
   `local_path` varchar(255),
   `install_path` varchar(255),
   `url` varchar(255),
-  `state` varchar(255) NOT NULL,  
+  `state` varchar(255) NOT NULL,
   `destroyed` tinyint(1) COMMENT 'indicates whether the volume_host entry was destroyed by the user or not',
   `update_count` bigint unsigned,
   `ref_cnt` bigint unsigned,
-  `updated` datetime,   
+  `updated` datetime,
   PRIMARY KEY  (`id`),
   CONSTRAINT `fk_volume_store_ref__store_id` FOREIGN KEY `fk_volume_store_ref__store_id` (`store_id`) REFERENCES `image_store` (`id`) ON DELETE CASCADE,
   INDEX `i_volume_store_ref__store_id`(`store_id`),
@@ -554,12 +554,12 @@ ALTER TABLE `cloud`.`remote_access_vpn` ADD COLUMN `id` bigint unsigned NOT NULL
 ALTER TABLE `cloud`.`remote_access_vpn` ADD COLUMN `uuid` varchar(40) UNIQUE;
 
 -- START: support for LXC
- 
+
 INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(uuid, hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES (UUID(), 'LXC', 'default', 50, 1);
 ALTER TABLE `cloud`.`physical_network_traffic_types` ADD COLUMN `lxc_network_label` varchar(255) DEFAULT 'cloudbr0' COMMENT 'The network name label of the physical device dedicated to this traffic on a LXC host';
- 
+
 UPDATE configuration SET value='KVM,XenServer,VMware,BareMetal,Ovm,LXC' WHERE name='hypervisor.list';
- 
+
 INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type)
      VALUES (10, UUID(), 'routing-10', 'SystemVM Template (LXC)', 0, now(), 'SYSTEM', 0, 64, 1, 'http://download.cloud.com/templates/acton/acton-systemvm-02062012.qcow2.bz2', '2755de1f9ef2ce4d6f2bee2efbb4da92', 0, 'SystemVM Template (LXC)', 'QCOW2', 15, 0, 1, 'LXC');
 
@@ -609,10 +609,10 @@ CREATE TABLE `cloud`.`service_offering_details` (
   CONSTRAINT `fk_service_offering_details__service_offering_id` FOREIGN KEY (`service_offering_id`) REFERENCES `service_offering`(`id`) ON DELETE CASCADE,
   CONSTRAINT UNIQUE KEY `uk_service_offering_id_name` (`service_offering_id`, `name`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-      
+
 DROP VIEW IF EXISTS `cloud`.`user_vm_view`;
 CREATE VIEW `cloud`.`user_vm_view` AS
-    select 
+    select
         vm_instance.id id,
         vm_instance.name name,
         user_vm.display_name display_name,
@@ -790,7 +790,7 @@ CREATE VIEW `cloud`.`user_vm_view` AS
 
 DROP VIEW IF EXISTS `cloud`.`affinity_group_view`;
 CREATE VIEW `cloud`.`affinity_group_view` AS
-    select 
+    select
         affinity_group.id id,
         affinity_group.name name,
         affinity_group.type type,
@@ -824,7 +824,7 @@ CREATE VIEW `cloud`.`affinity_group_view` AS
 
 DROP VIEW IF EXISTS `cloud`.`host_view`;
 CREATE VIEW `cloud`.`host_view` AS
-    select 
+    select
         host.id,
         host.uuid,
         host.name,
@@ -892,10 +892,10 @@ CREATE VIEW `cloud`.`host_view` AS
         `cloud`.`async_job` ON async_job.instance_id = host.id
             and async_job.instance_type = 'Host'
             and async_job.job_status = 0;
-        
+
 DROP VIEW IF EXISTS `cloud`.`storage_pool_view`;
 CREATE VIEW `cloud`.`storage_pool_view` AS
-    select 
+    select
         storage_pool.id,
         storage_pool.uuid,
         storage_pool.name,
@@ -915,7 +915,7 @@ CREATE VIEW `cloud`.`storage_pool_view` AS
         cluster.cluster_type,
         data_center.id data_center_id,
         data_center.uuid data_center_uuid,
-        data_center.name data_center_name,      
+	data_center.name data_center_name,
         data_center.networktype data_center_type,
         host_pod_ref.id pod_id,
         host_pod_ref.uuid pod_uuid,
@@ -945,11 +945,11 @@ CREATE VIEW `cloud`.`storage_pool_view` AS
         `cloud`.`async_job` ON async_job.instance_id = storage_pool.id
             and async_job.instance_type = 'StoragePool'
             and async_job.job_status = 0;
-            
+
 
 DROP VIEW IF EXISTS `cloud`.`domain_router_view`;
 CREATE VIEW `cloud`.`domain_router_view` AS
-    select 
+    select
         vm_instance.id id,
         vm_instance.name name,
         account.id account_id,
@@ -1048,7 +1048,7 @@ CREATE VIEW `cloud`.`domain_router_view` AS
         `cloud`.`async_job` ON async_job.instance_id = vm_instance.id
             and async_job.instance_type = 'DomainRouter'
             and async_job.job_status = 0;
-            
+
 CREATE TABLE `cloud`.`external_cisco_vnmc_devices` (
   `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
   `uuid` varchar(255) UNIQUE,
@@ -1133,7 +1133,7 @@ INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'manag
 
 DROP VIEW IF EXISTS `cloud`.`service_offering_view`;
 CREATE VIEW `cloud`.`service_offering_view` AS
-    select 
+    select
         service_offering.id,
         disk_offering.uuid,
         disk_offering.name,
@@ -1180,7 +1180,7 @@ UPDATE `cloud_usage`.`account` SET `default`=1 WHERE id IN (1,2);
 UPDATE `cloud`.`user` SET `cloud`.`user`.`default`=1 WHERE id IN (1,2);
 
 ALTER VIEW `cloud`.`user_view` AS
-    select 
+    select
         user.id,
         user.uuid,
         user.username,
@@ -1220,7 +1220,7 @@ ALTER VIEW `cloud`.`user_view` AS
         `cloud`.`async_job` ON async_job.instance_id = user.id
             and async_job.instance_type = 'User'
             and async_job.job_status = 0;
-       
+
 
 DROP VIEW IF EXISTS `cloud`.`account_view`;
 CREATE VIEW `cloud`.`account_view` AS
@@ -1773,7 +1773,7 @@ ALTER TABLE `cloud`.`account_details` MODIFY value varchar(255);
 
 DROP VIEW IF EXISTS `cloud`.`template_view`;
 CREATE VIEW `cloud`.`template_view` AS
-    select 
+    select
         vm_template.id,
         vm_template.uuid,
         vm_template.unique_name,
@@ -1814,7 +1814,7 @@ CREATE VIEW `cloud`.`template_view` AS
         domain.path domain_path,
         projects.id project_id,
         projects.uuid project_uuid,
-        projects.name project_name,        
+	projects.name project_name,
         data_center.id data_center_id,
         data_center.uuid data_center_uuid,
         data_center.name data_center_name,
@@ -1844,23 +1844,23 @@ CREATE VIEW `cloud`.`template_view` AS
     from
         `cloud`.`vm_template`
             inner join
-        `cloud`.`guest_os` ON guest_os.id = vm_template.guest_os_id        
+	`cloud`.`guest_os` ON guest_os.id = vm_template.guest_os_id
             inner join
         `cloud`.`account` ON account.id = vm_template.account_id
             inner join
         `cloud`.`domain` ON domain.id = account.domain_id
             left join
-        `cloud`.`projects` ON projects.project_account_id = account.id    
+	`cloud`.`projects` ON projects.project_account_id = account.id
             left join
-        `cloud`.`vm_template_details` ON vm_template_details.template_id = vm_template.id         
+	`cloud`.`vm_template_details` ON vm_template_details.template_id = vm_template.id
             left join
-        `cloud`.`vm_template` source_template ON source_template.id = vm_template.source_template_id    
+	`cloud`.`vm_template` source_template ON source_template.id = vm_template.source_template_id
             left join
         `cloud`.`template_store_ref` ON template_store_ref.template_id = vm_template.id and template_store_ref.store_role = 'Image'
             left join
-        `cloud`.`image_store` ON image_store.removed is NULL AND template_store_ref.store_id is not NULL AND image_store.id = template_store_ref.store_id 
+	`cloud`.`image_store` ON image_store.removed is NULL AND template_store_ref.store_id is not NULL AND image_store.id = template_store_ref.store_id
           left join
-        `cloud`.`template_zone_ref` ON template_zone_ref.template_id = vm_template.id AND template_store_ref.store_id is NULL AND template_zone_ref.removed is null    
+	`cloud`.`template_zone_ref` ON template_zone_ref.template_id = vm_template.id AND template_store_ref.store_id is NULL AND template_zone_ref.removed is null
             left join
         `cloud`.`data_center` ON (image_store.data_center_id = data_center.id OR template_zone_ref.zone_id = data_center.id)
             left join
@@ -1868,7 +1868,7 @@ CREATE VIEW `cloud`.`template_view` AS
             left join
         `cloud`.`resource_tags` ON resource_tags.resource_id = vm_template.id
             and (resource_tags.resource_type = 'Template' or resource_tags.resource_type='ISO');
-            
+
 INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Network', 'DEFAULT', 'management-server', 'midonet.apiserver.address', 'http://localhost:8081', 'Specify the address at which the Midonet API server can be contacted (if using Midonet)');
 INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Network', 'DEFAULT', 'management-server', 'midonet.providerrouter.id', 'd7c5e6a3-e2f4-426b-b728-b7ce6a0448e5', 'Specifies the UUID of the Midonet provider router (if using Midonet)');
 
@@ -1890,7 +1890,7 @@ CREATE TABLE `cloud`.`account_vnet_map` (
 
 ALTER TABLE `cloud`.`op_dc_vnet_alloc` ADD COLUMN account_vnet_map_id bigint unsigned;
 ALTER TABLE `cloud`.`op_dc_vnet_alloc` ADD CONSTRAINT `fk_op_dc_vnet_alloc__account_vnet_map_id` FOREIGN KEY `fk_op_dc_vnet_alloc__account_vnet_map_id` (`account_vnet_map_id`) REFERENCES `account_vnet_map` (`id`);
-            
+
  update  `cloud`.`vm_template` set state='Allocated' where state is NULL;
  update  `cloud`.`vm_template` set update_count=0 where update_count is NULL;
 
@@ -1994,7 +1994,7 @@ CREATE TABLE `cloud`.`vm_disk_statistics` (
   CONSTRAINT `fk_vm_disk_statistics__account_id` FOREIGN KEY (`account_id`) REFERENCES `account` (`id`) ON DELETE CASCADE
 ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
 
-insert into `cloud`.`vm_disk_statistics`(data_center_id,account_id,vm_id,volume_id) 
+insert into `cloud`.`vm_disk_statistics`(data_center_id,account_id,vm_id,volume_id)
 select volumes.data_center_id, volumes.account_id, vm_instance.id, volumes.id from volumes,vm_instance where vm_instance.vm_type="User" and vm_instance.state<>"Expunging" and volumes.instance_id=vm_instance.id order by vm_instance.id;
 
 DROP TABLE IF EXISTS `cloud_usage`.`vm_disk_statistics`;
@@ -2102,7 +2102,7 @@ CREATE TABLE `cloud`.`external_stratosphere_ssp_credentials` (
 
 DROP VIEW IF EXISTS `cloud`.`project_view`;
 CREATE VIEW `cloud`.`project_view` AS
-    select 
+    select
         projects.id,
         projects.uuid,
         projects.name,
@@ -2151,7 +2151,6 @@ INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'manag
 INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'ldap.user.object', 'inetOrgPerson', 'Sets the object type of users within LDAP');
 INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'ldap.basedn', NULL, 'Sets the basedn for LDAP');
 INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'ldap.search.group.principle', NULL, 'Sets the principle of the group that users must be a member of');
-INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'ldap.ssl.enabled', 'false', 'Enables/Disables SSL support for LDAP');
 INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'ldap.truststore', NULL, 'Sets the path to the truststore to use for LDAP SSL');
 INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'ldap.truststore.password', NULL, 'Sets the password for the truststore');
 
@@ -2166,7 +2165,7 @@ CREATE TABLE `cloud`.`ldap_configuration` (
 INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Network', 'DEFAULT', 'management-server', 'network.loadbalancer.haproxy.max.conn', '4096', 'Load Balancer(haproxy) maximum number of concurrent connections(global max)');
 
 ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `concurrent_connections` int(10) unsigned COMMENT 'Load Balancer(haproxy) maximum number of concurrent connections(global max)';
-        
+
 ALTER TABLE `cloud`.`sync_queue` MODIFY `queue_size` smallint(6) NOT NULL DEFAULT '0' COMMENT 'number of items being processed by the queue';
 ALTER TABLE `cloud`.`sync_queue` MODIFY `queue_size_limit` smallint(6) NOT NULL DEFAULT '1' COMMENT 'max number of items the queue can process concurrently';
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25e8e9b8/ui/dictionary.jsp
----------------------------------------------------------------------
diff --git a/ui/dictionary.jsp b/ui/dictionary.jsp
index 24c7e5e..88de8c0 100644
--- a/ui/dictionary.jsp
+++ b/ui/dictionary.jsp
@@ -515,7 +515,7 @@ dictionary = {
 'label.edit.lb.rule': '<fmt:message key="label.edit.lb.rule" />',
 'label.edit.network.details': '<fmt:message key="label.edit.network.details" />',
 'label.edit.project.details': '<fmt:message key="label.edit.project.details" />',
-'label.edit.tags': '<fmt:message key="label.edit.tags" />',  
+'label.edit.tags': '<fmt:message key="label.edit.tags" />',
 'label.edit.traffic.type': '<fmt:message key="label.edit.traffic.type" />',
 'label.edit.vpc': '<fmt:message key="label.edit.vpc" />',
 'label.egress.rule': '<fmt:message key="label.egress.rule" />',

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25e8e9b8/ui/scripts/autoscaler.js
----------------------------------------------------------------------
diff --git a/ui/scripts/autoscaler.js b/ui/scripts/autoscaler.js
index b2aa56b..9ae3fd5 100644
--- a/ui/scripts/autoscaler.js
+++ b/ui/scripts/autoscaler.js
@@ -1341,7 +1341,7 @@
                         array1.push("&interval=" + args.data.interval);
                         array1.push("&scaleuppolicyids=" + args.scaleUpPolicyResponse.id);
                         array1.push("&scaledownpolicyids=" + args.scaleDownPolicyResponse.id);
-                        
+
                         $.ajax({
                             url: createURL('createAutoScaleVmGroup' + array1.join("")),
                             dataType: 'json',

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25e8e9b8/ui/scripts/sharedFunctions.js
----------------------------------------------------------------------
diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js
index a9df896..bd932c7 100644
--- a/ui/scripts/sharedFunctions.js
+++ b/ui/scripts/sharedFunctions.js
@@ -715,7 +715,7 @@ var addGuestNetworkDialog = {
         return result;
     }
 
-// Role Functions
+    // Role Functions
 
     function isAdmin() {
         return (g_role == 1);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25e8e9b8/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index 569e978..56eaec3 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -6488,11 +6488,13 @@
                                                                 selectedZoneObj.vmwaredcId = vmwaredcs[0].id;
                                                             }
                                                         },
-                                                        error: function(XMLHttpResponse) { //override default error handling: cloudStack.dialog.notice({ message: parseXMLHttpResponse(XMLHttpResponse)});                                                      	
-                                                        	if(parseXMLHttpResponse(XMLHttpResponse) == 'The given command does not exist or it is not available for user')
-                                                        		return; //do nothing
-                                                        	else 
-                                                        		cloudStack.dialog.notice({ message: parseXMLHttpResponse(XMLHttpResponse)}); //pop up error dialog box if the error is not 'The given command does not exist or it is not available for user'
+							error: function(XMLHttpResponse) { //override default error handling: cloudStack.dialog.notice({ message: parseXMLHttpResponse(XMLHttpResponse)});
+							    if (parseXMLHttpResponse(XMLHttpResponse) == 'The given command does not exist or it is not available for user')
+								return; //do nothing
+							    else
+								cloudStack.dialog.notice({
+								    message: parseXMLHttpResponse(XMLHttpResponse)
+								}); //pop up error dialog box if the error is not 'The given command does not exist or it is not available for user'
                                                         }
                                                     });
 
@@ -7425,17 +7427,17 @@
                                             var systemvmObjs = json.listsystemvmsresponse.systemvm;
                                             if (systemvmObjs != null) {
                                                 $.ajax({
-                                                    url: createURL("listHosts&listAll=true"),                                                    
+						    url: createURL("listHosts&listAll=true"),
                                                     success: function(json) {
                                                         var hostObjs = json.listhostsresponse.host;
                                                         for (var i = 0; i < systemvmObjs.length; i++) {
-                                                        	for (var k = 0; k < hostObjs.length; k++) {
-                                                        		if (hostObjs[k].name == systemvmObjs[i].name) {
-                                                        			systemvmObjs[i].agentstate = hostObjs[k].state;
-                                                        			break;
-                                                        		}
-                                                        	}
-                                                        }    
+							    for (var k = 0; k < hostObjs.length; k++) {
+								if (hostObjs[k].name == systemvmObjs[i].name) {
+								    systemvmObjs[i].agentstate = hostObjs[k].state;
+								    break;
+								}
+							    }
+							}
                                                         args.response.success({
                                                             data: systemvmObjs
                                                         });
@@ -10125,7 +10127,7 @@
                                                             notification: {
                                                                 poll: pollAsyncJobResult,
                                                                 interval: 4500,
-                                                                desc: "Dedicate Pod"    
+								desc: "Dedicate Pod"
                                                             },
 
                                                             data: item
@@ -11201,7 +11203,7 @@
                                 $.ajax({
                                     url: createURL("addCluster" + array1.join("")),
                                     dataType: "json",
-                                    type: "POST",                                    
+				    type: "POST",
                                     success: function(json) {
                                         var item = json.addclusterresponse.cluster[0];
                                         clusterId = json.addclusterresponse.cluster[0].id;
@@ -14116,14 +14118,14 @@
                             label: 'label.url'
                         }
                     },
-                    dataProvider: function(args) {                       
-			            $.ajax({
-			              url: createURL('listUcsManager'),
-			              data: {
-			                zoneid: args.context.physicalResources[0].id
-			              },
-			              success: function(json) {	
-			            	  /*	            	  
+		    dataProvider: function(args) {
+			$.ajax({
+			    url: createURL('listUcsManager'),
+			    data: {
+				zoneid: args.context.physicalResources[0].id
+			    },
+			    success: function(json) {
+				/*
 			            	  json = //override json (for testing only)
 			            	  {
 			            	      "listucsmanagerreponse": {
@@ -14138,11 +14140,13 @@
 			            		      ]
 			            	      }
 			            	  };
-			            	  */			            	  
-			            	  var items = json.listucsmanagerreponse.ucsmanager;
-			            	  args.response.success({ data: items });			            	  
-			              }
-			            });
+					  */
+				var items = json.listucsmanagerreponse.ucsmanager;
+				args.response.success({
+				    data: items
+				});
+			    }
+			});
                     },
                     actions: {
                         add: {
@@ -14363,8 +14367,8 @@
 														            "bladedn": "sys/chassis-1/blade-2"
 														        }
 														    }
-														}   
-														*/                                                     	
+														}
+														*/
                                                         args.response.success({
                                                             data: {
                                                                 associatedProfileDn: args.data.profiledn

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25e8e9b8/ui/scripts/ui-custom/accountsWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui-custom/accountsWizard.js b/ui/scripts/ui-custom/accountsWizard.js
index 628cc34..88cff58 100644
--- a/ui/scripts/ui-custom/accountsWizard.js
+++ b/ui/scripts/ui-custom/accountsWizard.js
@@ -97,7 +97,7 @@
                         dataType: "json",
                         async: false,
                         success: function(json) {
-			    if(json.ldapuserresponse.count > 0) {
+			    if (json.ldapuserresponse.count > 0) {
 				$(json.ldapuserresponse.LdapUser).each(function() {
 				    var result = $("<tr>");
 				    result.append("<td><input type=\"checkbox\" class=\"required\" name=\"username\" value=\"" + this.username + "\"></td>");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25e8e9b8/ui/scripts/ui-custom/installWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui-custom/installWizard.js b/ui/scripts/ui-custom/installWizard.js
index f7ed074..de4c0df 100644
--- a/ui/scripts/ui-custom/installWizard.js
+++ b/ui/scripts/ui-custom/installWizard.js
@@ -767,9 +767,10 @@
                         label: 'label.provider',
                         select: function(args) {
                             args.response.success({
-                                data: [
-                                    { id: 'NFS', description: 'NFS' }
-                                ]
+				data: [{
+				    id: 'NFS',
+				    description: 'NFS'
+				}]
                             });
                         }
                     },

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25e8e9b8/ui/scripts/ui/dialog.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/dialog.js b/ui/scripts/ui/dialog.js
index 1ff5401..7042c95 100644
--- a/ui/scripts/ui/dialog.js
+++ b/ui/scripts/ui/dialog.js
@@ -38,11 +38,11 @@
         createForm: function(args) {
             var $formContainer = $('<div>').addClass('form-container');
             var $form = $('<form>').appendTo($formContainer)
-                    .submit(function() {
-                        $(this).closest('.ui-dialog').find('button.ok').click();
+		.submit(function() {
+		    $(this).closest('.ui-dialog').find('button.ok').click();
 
-                        return false;
-                    });
+		    return false;
+		});
             var createLabel = _l(args.form.createLabel);
 
             // Description text
@@ -130,10 +130,10 @@
                 var field = args.form.fields[key];
 
                 var $formItem = $('<div>')
-                        .addClass('form-item')
-                        .attr({
-                            rel: key
-                        });
+		    .addClass('form-item')
+		    .attr({
+			rel: key
+		    });
 
                 if (field.isHidden != null) {
                     if (typeof(field.isHidden) == 'boolean' && field.isHidden == true)
@@ -167,10 +167,10 @@
                 // Label field
 
                 var $name = $('<div>').addClass('name')
-                        .appendTo($formItem)
-                        .append(
-                            $('<label>').html(_l(field.label) + ':')
-                        );
+		    .appendTo($formItem)
+		    .append(
+			$('<label>').html(_l(field.label) + ':')
+		);
 
                 // red asterisk
                 var $astersikSpan = $('<span>').addClass('field-required').html('*');
@@ -189,7 +189,7 @@
 
                 // Input area
                 var $value = $('<div>').addClass('value')
-                        .appendTo($formItem);
+		    .appendTo($formItem);
                 var $input, $dependsOn, selectFn, selectArgs;
                 var dependsOn = field.dependsOn;
 
@@ -219,7 +219,7 @@
                                     }
                                 });
                             } else if (($target.is(':unchecked') && !isReverse) ||
-                                       ($target.is(':checked') && isReverse)) {
+				($target.is(':checked') && isReverse)) {
                                 $dependent.hide();
                             }
 
@@ -258,9 +258,9 @@
                                         description = this.description;
 
                                     var $option = $('<option>')
-                                            .appendTo($input)
-                                            .val(_s(id))
-                                            .html(_s(description));
+					.appendTo($input)
+					.val(_s(id))
+					.html(_s(description));
                                 });
 
                                 if (field.defaultValue) {
@@ -310,7 +310,9 @@
 
                                 // Make sure all data is loaded to pass to select fn
                                 dependsOnLoaded = $.inArray(
-                                    true, $dependsOn.map(function(index, item) { return $(item).find('option').size() ? true : false; })
+				    true, $dependsOn.map(function(index, item) {
+					return $(item).find('option').size() ? true : false;
+				    })
                                 ) > -1;
 
                                 if (!dependsOnLoaded) {
@@ -347,17 +349,17 @@
                         $.each(field.multiArray, function(itemKey, itemValue) {
                             $input.append(
                                 $('<div>').addClass('item')
-                                    .append(
-                                        $.merge(
-                                            $('<div>').addClass('name').html(_l(itemValue.label)),
-                                            $('<div>').addClass('value').append(
-                                                $('<input>').attr({
-                                                    name: itemKey,
-                                                    type: 'checkbox'
-                                                }).appendTo($value)
-                                            )
+				.append(
+				    $.merge(
+					$('<div>').addClass('name').html(_l(itemValue.label)),
+					$('<div>').addClass('value').append(
+					    $('<input>').attr({
+						name: itemKey,
+						type: 'checkbox'
+					    }).appendTo($value)
                                         )
                                     )
+				)
                             );
                         });
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25e8e9b8/ui/scripts/ui/widgets/listView.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/widgets/listView.js b/ui/scripts/ui/widgets/listView.js
index 6b44d99..0a2166b 100644
--- a/ui/scripts/ui/widgets/listView.js
+++ b/ui/scripts/ui/widgets/listView.js
@@ -185,7 +185,7 @@
                                     return false;
                                 });
 
-                                if(args.notification) notification = args.notification;
+				if (args.notification) notification = args.notification;
 
                                 notification._custom = args._custom;
 
@@ -259,7 +259,7 @@
                                                 $instanceRow.remove();
                                             } else {
                                                 // For standard actions
-                                                if(!args.notification) {
+						if (!args.notification) {
                                                     replaceItem(
                                                         $instanceRow,
                                                         $.extend($instanceRow.data('json-obj'), errorArgs.data),
@@ -534,10 +534,12 @@
                 showEditField();
             } else if ($editInput.val() != $label.html()) { //click Save button with changed value
                 if ($editInput.val().match(/<|>/)) {
-                    cloudStack.dialog.notice({ message: 'message.validate.invalid.characters' }); 
+		    cloudStack.dialog.notice({
+			message: 'message.validate.invalid.characters'
+		    });
                     return false;
                 }
-                
+
                 $edit.animate({
                     opacity: 0.5
                 });


Mime
View raw message