Repository: ambari Updated Branches: refs/heads/trunk 09c6d117e -> 70bbd5a55
AMBARI-6186. AmbariLdapAuthenticationProviderTest.testAuthenticate unit test fail. (mpapirkovskyy) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7efb9d8c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7efb9d8c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7efb9d8c Branch: refs/heads/trunk Commit: 7efb9d8c3ae357dfbafcc4ef55505dff6f4a97a0 Parents: 09c6d11 Author: Myroslav Papirkovskyy <[email protected]> Authored: Wed Jun 18 17:22:39 2014 +0300 Committer: Myroslav Papirkovskyy <[email protected]> Committed: Thu Jun 19 23:34:40 2014 +0300 ---------------------------------------------------------------------- .../AmbariLdapAuthenticationProviderTest.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/7efb9d8c/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderTest.java index 4052731..93d4f5f 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderTest.java @@ -17,6 +17,7 @@ */ package org.apache.ambari.server.security.authorization; +import com.google.inject.persist.PersistService; import junit.framework.Assert; import com.google.inject.Guice; @@ -31,6 +32,7 @@ import org.apache.ambari.server.orm.entities.UserEntity; import org.apache.ambari.server.security.ClientSecurityType; import org.easymock.EasyMockSupport; import org.easymock.IAnswer; +import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; @@ -60,9 +62,6 @@ public class AmbariLdapAuthenticationProviderTest extends EasyMockSupport { @BeforeClass public static void beforeClass() throws Exception{ - injector = Guice.createInjector(new AuthorizationTestModule()); - injector.getInstance(GuiceJpaInitializer.class); - apacheDSContainer = new ApacheDSContainer("dc=ambari,dc=apache,dc=org", "classpath:/users.ldif"); apacheDSContainer.setPort(33389); apacheDSContainer.afterPropertiesSet(); @@ -70,17 +69,23 @@ public class AmbariLdapAuthenticationProviderTest extends EasyMockSupport { @Before public void setUp() { + injector = Guice.createInjector(new AuthorizationTestModule()); injector.injectMembers(this); + injector.getInstance(GuiceJpaInitializer.class); configuration.setClientSecurityType(ClientSecurityType.LDAP); } + @After + public void tearDown() throws Exception { + injector.getInstance(PersistService.class).stop(); + } + @Test(expected = BadCredentialsException.class) public void testBadCredential() throws Exception { Authentication authentication = new UsernamePasswordAuthenticationToken("notFound", "wrong"); authenticationProvider.authenticate(authentication); } - @Test public void testGoodManagerCredentials() throws Exception { AmbariLdapAuthoritiesPopulator authoritiesPopulator = createMock(AmbariLdapAuthoritiesPopulator.class);
