|
@@ -91,17 +91,17 @@ public class TestUserGroupInformation {
|
|
UserGroupInformation.setLoginUser(null);
|
|
UserGroupInformation.setLoginUser(null);
|
|
}
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
public void testSimpleLogin() throws IOException {
|
|
public void testSimpleLogin() throws IOException {
|
|
tryLoginAuthenticationMethod(AuthenticationMethod.SIMPLE, true);
|
|
tryLoginAuthenticationMethod(AuthenticationMethod.SIMPLE, true);
|
|
}
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
public void testTokenLogin() throws IOException {
|
|
public void testTokenLogin() throws IOException {
|
|
tryLoginAuthenticationMethod(AuthenticationMethod.TOKEN, false);
|
|
tryLoginAuthenticationMethod(AuthenticationMethod.TOKEN, false);
|
|
}
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
public void testProxyLogin() throws IOException {
|
|
public void testProxyLogin() throws IOException {
|
|
tryLoginAuthenticationMethod(AuthenticationMethod.PROXY, false);
|
|
tryLoginAuthenticationMethod(AuthenticationMethod.PROXY, false);
|
|
}
|
|
}
|
|
@@ -130,7 +130,7 @@ public class TestUserGroupInformation {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
public void testGetRealAuthenticationMethod() {
|
|
public void testGetRealAuthenticationMethod() {
|
|
UserGroupInformation ugi = UserGroupInformation.createRemoteUser("user1");
|
|
UserGroupInformation ugi = UserGroupInformation.createRemoteUser("user1");
|
|
ugi.setAuthenticationMethod(AuthenticationMethod.SIMPLE);
|
|
ugi.setAuthenticationMethod(AuthenticationMethod.SIMPLE);
|
|
@@ -141,7 +141,7 @@ public class TestUserGroupInformation {
|
|
assertEquals(AuthenticationMethod.SIMPLE, ugi.getRealAuthenticationMethod());
|
|
assertEquals(AuthenticationMethod.SIMPLE, ugi.getRealAuthenticationMethod());
|
|
}
|
|
}
|
|
/** Test login method */
|
|
/** Test login method */
|
|
- @Test
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
public void testLogin() throws Exception {
|
|
public void testLogin() throws Exception {
|
|
// login from unix
|
|
// login from unix
|
|
UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
|
|
UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
|
|
@@ -168,7 +168,7 @@ public class TestUserGroupInformation {
|
|
* given user name - get all the groups.
|
|
* given user name - get all the groups.
|
|
* Needs to happen before creating the test users
|
|
* Needs to happen before creating the test users
|
|
*/
|
|
*/
|
|
- @Test
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
public void testGetServerSideGroups() throws IOException,
|
|
public void testGetServerSideGroups() throws IOException,
|
|
InterruptedException {
|
|
InterruptedException {
|
|
// get the user name
|
|
// get the user name
|
|
@@ -228,7 +228,7 @@ public class TestUserGroupInformation {
|
|
}
|
|
}
|
|
|
|
|
|
/** test constructor */
|
|
/** test constructor */
|
|
- @Test
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
public void testConstructor() throws Exception {
|
|
public void testConstructor() throws Exception {
|
|
UserGroupInformation ugi =
|
|
UserGroupInformation ugi =
|
|
UserGroupInformation.createUserForTesting("user2/cron@HADOOP.APACHE.ORG",
|
|
UserGroupInformation.createUserForTesting("user2/cron@HADOOP.APACHE.ORG",
|
|
@@ -254,7 +254,7 @@ public class TestUserGroupInformation {
|
|
assertTrue(gotException);
|
|
assertTrue(gotException);
|
|
}
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
public void testEquals() throws Exception {
|
|
public void testEquals() throws Exception {
|
|
UserGroupInformation uugi =
|
|
UserGroupInformation uugi =
|
|
UserGroupInformation.createUserForTesting(USER_NAME, GROUP_NAMES);
|
|
UserGroupInformation.createUserForTesting(USER_NAME, GROUP_NAMES);
|
|
@@ -272,7 +272,7 @@ public class TestUserGroupInformation {
|
|
assertEquals(uugi.hashCode(), ugi3.hashCode());
|
|
assertEquals(uugi.hashCode(), ugi3.hashCode());
|
|
}
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
public void testEqualsWithRealUser() throws Exception {
|
|
public void testEqualsWithRealUser() throws Exception {
|
|
UserGroupInformation realUgi1 = UserGroupInformation.createUserForTesting(
|
|
UserGroupInformation realUgi1 = UserGroupInformation.createUserForTesting(
|
|
"RealUser", GROUP_NAMES);
|
|
"RealUser", GROUP_NAMES);
|
|
@@ -285,7 +285,7 @@ public class TestUserGroupInformation {
|
|
assertFalse(remoteUgi.equals(proxyUgi1));
|
|
assertFalse(remoteUgi.equals(proxyUgi1));
|
|
}
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
public void testGettingGroups() throws Exception {
|
|
public void testGettingGroups() throws Exception {
|
|
UserGroupInformation uugi =
|
|
UserGroupInformation uugi =
|
|
UserGroupInformation.createUserForTesting(USER_NAME, GROUP_NAMES);
|
|
UserGroupInformation.createUserForTesting(USER_NAME, GROUP_NAMES);
|
|
@@ -295,7 +295,7 @@ public class TestUserGroupInformation {
|
|
}
|
|
}
|
|
|
|
|
|
@SuppressWarnings("unchecked") // from Mockito mocks
|
|
@SuppressWarnings("unchecked") // from Mockito mocks
|
|
- @Test
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
public <T extends TokenIdentifier> void testAddToken() throws Exception {
|
|
public <T extends TokenIdentifier> void testAddToken() throws Exception {
|
|
UserGroupInformation ugi =
|
|
UserGroupInformation ugi =
|
|
UserGroupInformation.createRemoteUser("someone");
|
|
UserGroupInformation.createRemoteUser("someone");
|
|
@@ -333,7 +333,7 @@ public class TestUserGroupInformation {
|
|
}
|
|
}
|
|
|
|
|
|
@SuppressWarnings("unchecked") // from Mockito mocks
|
|
@SuppressWarnings("unchecked") // from Mockito mocks
|
|
- @Test
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
public <T extends TokenIdentifier> void testGetCreds() throws Exception {
|
|
public <T extends TokenIdentifier> void testGetCreds() throws Exception {
|
|
UserGroupInformation ugi =
|
|
UserGroupInformation ugi =
|
|
UserGroupInformation.createRemoteUser("someone");
|
|
UserGroupInformation.createRemoteUser("someone");
|
|
@@ -359,7 +359,7 @@ public class TestUserGroupInformation {
|
|
}
|
|
}
|
|
|
|
|
|
@SuppressWarnings("unchecked") // from Mockito mocks
|
|
@SuppressWarnings("unchecked") // from Mockito mocks
|
|
- @Test
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
public <T extends TokenIdentifier> void testAddCreds() throws Exception {
|
|
public <T extends TokenIdentifier> void testAddCreds() throws Exception {
|
|
UserGroupInformation ugi =
|
|
UserGroupInformation ugi =
|
|
UserGroupInformation.createRemoteUser("someone");
|
|
UserGroupInformation.createRemoteUser("someone");
|
|
@@ -384,7 +384,7 @@ public class TestUserGroupInformation {
|
|
assertSame(secret, ugi.getCredentials().getSecretKey(secretKey));
|
|
assertSame(secret, ugi.getCredentials().getSecretKey(secretKey));
|
|
}
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
public <T extends TokenIdentifier> void testGetCredsNotSame()
|
|
public <T extends TokenIdentifier> void testGetCredsNotSame()
|
|
throws Exception {
|
|
throws Exception {
|
|
UserGroupInformation ugi =
|
|
UserGroupInformation ugi =
|
|
@@ -412,7 +412,7 @@ public class TestUserGroupInformation {
|
|
}
|
|
}
|
|
|
|
|
|
@SuppressWarnings("unchecked") // from Mockito mocks
|
|
@SuppressWarnings("unchecked") // from Mockito mocks
|
|
- @Test
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
public <T extends TokenIdentifier> void testAddNamedToken() throws Exception {
|
|
public <T extends TokenIdentifier> void testAddNamedToken() throws Exception {
|
|
UserGroupInformation ugi =
|
|
UserGroupInformation ugi =
|
|
UserGroupInformation.createRemoteUser("someone");
|
|
UserGroupInformation.createRemoteUser("someone");
|
|
@@ -433,7 +433,7 @@ public class TestUserGroupInformation {
|
|
}
|
|
}
|
|
|
|
|
|
@SuppressWarnings("unchecked") // from Mockito mocks
|
|
@SuppressWarnings("unchecked") // from Mockito mocks
|
|
- @Test
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
public <T extends TokenIdentifier> void testUGITokens() throws Exception {
|
|
public <T extends TokenIdentifier> void testUGITokens() throws Exception {
|
|
UserGroupInformation ugi =
|
|
UserGroupInformation ugi =
|
|
UserGroupInformation.createUserForTesting("TheDoctor",
|
|
UserGroupInformation.createUserForTesting("TheDoctor",
|
|
@@ -479,7 +479,7 @@ public class TestUserGroupInformation {
|
|
assertTrue(otherSet.contains(t2));
|
|
assertTrue(otherSet.contains(t2));
|
|
}
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
public void testTokenIdentifiers() throws Exception {
|
|
public void testTokenIdentifiers() throws Exception {
|
|
UserGroupInformation ugi = UserGroupInformation.createUserForTesting(
|
|
UserGroupInformation ugi = UserGroupInformation.createUserForTesting(
|
|
"TheDoctor", new String[] { "TheTARDIS" });
|
|
"TheDoctor", new String[] { "TheTARDIS" });
|
|
@@ -507,7 +507,7 @@ public class TestUserGroupInformation {
|
|
assertEquals(2, otherSet.size());
|
|
assertEquals(2, otherSet.size());
|
|
}
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
public void testTestAuthMethod() throws Exception {
|
|
public void testTestAuthMethod() throws Exception {
|
|
UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
|
|
UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
|
|
// verify the reverse mappings works
|
|
// verify the reverse mappings works
|
|
@@ -519,7 +519,7 @@ public class TestUserGroupInformation {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
public void testUGIAuthMethod() throws Exception {
|
|
public void testUGIAuthMethod() throws Exception {
|
|
final UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
|
|
final UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
|
|
final AuthenticationMethod am = AuthenticationMethod.KERBEROS;
|
|
final AuthenticationMethod am = AuthenticationMethod.KERBEROS;
|
|
@@ -535,7 +535,7 @@ public class TestUserGroupInformation {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
public void testUGIAuthMethodInRealUser() throws Exception {
|
|
public void testUGIAuthMethodInRealUser() throws Exception {
|
|
final UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
|
|
final UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
|
|
UserGroupInformation proxyUgi = UserGroupInformation.createProxyUser(
|
|
UserGroupInformation proxyUgi = UserGroupInformation.createProxyUser(
|
|
@@ -570,7 +570,7 @@ public class TestUserGroupInformation {
|
|
Assert.assertEquals(proxyUgi3, proxyUgi4);
|
|
Assert.assertEquals(proxyUgi3, proxyUgi4);
|
|
}
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
public void testLoginObjectInSubject() throws Exception {
|
|
public void testLoginObjectInSubject() throws Exception {
|
|
UserGroupInformation loginUgi = UserGroupInformation.getLoginUser();
|
|
UserGroupInformation loginUgi = UserGroupInformation.getLoginUser();
|
|
UserGroupInformation anotherUgi = new UserGroupInformation(loginUgi
|
|
UserGroupInformation anotherUgi = new UserGroupInformation(loginUgi
|
|
@@ -583,7 +583,7 @@ public class TestUserGroupInformation {
|
|
Assert.assertTrue(login1 == login2);
|
|
Assert.assertTrue(login1 == login2);
|
|
}
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
public void testLoginModuleCommit() throws Exception {
|
|
public void testLoginModuleCommit() throws Exception {
|
|
UserGroupInformation loginUgi = UserGroupInformation.getLoginUser();
|
|
UserGroupInformation loginUgi = UserGroupInformation.getLoginUser();
|
|
User user1 = loginUgi.getSubject().getPrincipals(User.class).iterator()
|
|
User user1 = loginUgi.getSubject().getPrincipals(User.class).iterator()
|
|
@@ -617,7 +617,7 @@ public class TestUserGroupInformation {
|
|
* with it, but that Subject was not created by Hadoop (ie it has no
|
|
* with it, but that Subject was not created by Hadoop (ie it has no
|
|
* associated User principal)
|
|
* associated User principal)
|
|
*/
|
|
*/
|
|
- @Test
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
public void testUGIUnderNonHadoopContext() throws Exception {
|
|
public void testUGIUnderNonHadoopContext() throws Exception {
|
|
Subject nonHadoopSubject = new Subject();
|
|
Subject nonHadoopSubject = new Subject();
|
|
Subject.doAs(nonHadoopSubject, new PrivilegedExceptionAction<Void>() {
|
|
Subject.doAs(nonHadoopSubject, new PrivilegedExceptionAction<Void>() {
|
|
@@ -631,7 +631,7 @@ public class TestUserGroupInformation {
|
|
}
|
|
}
|
|
|
|
|
|
/** Test hasSufficientTimeElapsed method */
|
|
/** Test hasSufficientTimeElapsed method */
|
|
- @Test
|
|
|
|
|
|
+ @Test (timeout = 30000)
|
|
public void testHasSufficientTimeElapsed() throws Exception {
|
|
public void testHasSufficientTimeElapsed() throws Exception {
|
|
// Make hasSufficientTimeElapsed public
|
|
// Make hasSufficientTimeElapsed public
|
|
Method method = UserGroupInformation.class
|
|
Method method = UserGroupInformation.class
|