use of org.apache.accumulo.core.client.impl.AuthenticationTokenIdentifier in project accumulo by apache.
the class AuthenticationTokenIdentifierTest method testNullMsg.
@Test
public void testNullMsg() throws IOException {
AuthenticationTokenIdentifier token = new AuthenticationTokenIdentifier();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(baos);
token.write(out);
DataInputStream in = new DataInputStream(new ByteArrayInputStream(baos.toByteArray()));
AuthenticationTokenIdentifier deserializedToken = new AuthenticationTokenIdentifier();
deserializedToken.readFields(in);
assertEquals(token, deserializedToken);
assertEquals(token.hashCode(), deserializedToken.hashCode());
assertEquals(token.toString(), deserializedToken.toString());
}
use of org.apache.accumulo.core.client.impl.AuthenticationTokenIdentifier in project accumulo by apache.
the class AuthenticationTokenIdentifierTest method testUgi.
@Test
public void testUgi() {
String principal = "user";
AuthenticationTokenIdentifier token = new AuthenticationTokenIdentifier(principal);
UserGroupInformation actual = token.getUser(), expected = UserGroupInformation.createRemoteUser(principal);
assertEquals(expected.getAuthenticationMethod(), actual.getAuthenticationMethod());
assertEquals(expected.getUserName(), expected.getUserName());
}
use of org.apache.accumulo.core.client.impl.AuthenticationTokenIdentifier in project accumulo by apache.
the class AuthenticationTokenIdentifierTest method testExtendedEquality.
@Test
public void testExtendedEquality() {
String principal = "user";
AuthenticationTokenIdentifier token = new AuthenticationTokenIdentifier(principal);
assertEquals(token, token);
AuthenticationTokenIdentifier newToken = new AuthenticationTokenIdentifier(principal, 1, 5l, 10l, "uuid");
assertNotEquals(token, newToken);
assertNotEquals(token.hashCode(), newToken.hashCode());
AuthenticationTokenIdentifier dblNewToken = new AuthenticationTokenIdentifier(principal);
dblNewToken.setKeyId(1);
dblNewToken.setIssueDate(5l);
dblNewToken.setExpirationDate(10l);
dblNewToken.setInstanceId("uuid");
}
use of org.apache.accumulo.core.client.impl.AuthenticationTokenIdentifier in project accumulo by apache.
the class AuthenticationTokenIdentifierTest method testToString.
@Test
public void testToString() {
String principal = "my_special_principal";
AuthenticationTokenIdentifier token = new AuthenticationTokenIdentifier(principal);
assertTrue(token.toString().contains(principal));
}
use of org.apache.accumulo.core.client.impl.AuthenticationTokenIdentifier in project accumulo by apache.
the class AuthenticationTokenIdentifierTest method testEquality.
@Test
public void testEquality() {
String principal = "user";
AuthenticationTokenIdentifier token = new AuthenticationTokenIdentifier(principal);
assertEquals(token, token);
AuthenticationTokenIdentifier newToken = new AuthenticationTokenIdentifier(principal);
assertEquals(token, newToken);
assertEquals(token.hashCode(), newToken.hashCode());
}
Aggregations