use of tech.aroma.thrift.authentication.AuthenticationToken in project aroma-data-operations by RedRoma.
the class CassandraTokenRepositoryTest method testSaveTokenWithBadArgs.
@Test
public void testSaveTokenWithBadArgs() throws Exception {
assertThrows(() -> instance.saveToken(null)).isInstanceOf(InvalidArgumentException.class);
AuthenticationToken missingTokenId = new AuthenticationToken(token);
missingTokenId.unsetTokenId();
assertThrows(() -> instance.saveToken(missingTokenId)).isInstanceOf(InvalidArgumentException.class);
AuthenticationToken missingOwnerId = new AuthenticationToken(token);
missingOwnerId.unsetOwnerId();
assertThrows(() -> instance.saveToken(missingOwnerId)).isInstanceOf(InvalidArgumentException.class);
AuthenticationToken missingTokenType = new AuthenticationToken(token);
missingTokenType.unsetTokenType();
assertThrows(() -> instance.saveToken(missingTokenType)).isInstanceOf(InvalidArgumentException.class);
}
use of tech.aroma.thrift.authentication.AuthenticationToken in project aroma-data-operations by RedRoma.
the class CassandraTokenRepositoryTest method testGetTokenWithoutOrgId.
@Test
public void testGetTokenWithoutOrgId() throws Exception {
token.unsetOrganizationId();
token.unsetOrganizationName();
instance.saveToken(token);
AuthenticationToken result = instance.getToken(tokenId);
assertThat(result, is(token));
}
use of tech.aroma.thrift.authentication.AuthenticationToken in project aroma-data-operations by RedRoma.
the class CassandraTokenRepositoryIT method testGetTokenWithoutOrgId.
@Test
public void testGetTokenWithoutOrgId() throws Exception {
token.unsetOrganizationId();
token.unsetOrganizationName();
instance.saveToken(token);
AuthenticationToken result = instance.getToken(tokenId);
assertThat(result, is(token));
}
use of tech.aroma.thrift.authentication.AuthenticationToken in project aroma-data-operations by RedRoma.
the class CassandraTokenRepositoryIT method testGetToken.
@Test
public void testGetToken() throws Exception {
instance.saveToken(token);
AuthenticationToken result = instance.getToken(tokenId);
assertThat(result, is(token));
}
use of tech.aroma.thrift.authentication.AuthenticationToken in project aroma-data-operations by RedRoma.
the class MemoryTokenRepositoryTest method testDeleteTokens.
@Test
public void testDeleteTokens() throws Exception {
for (AuthenticationToken token : tokens) {
repository.saveToken(token);
}
List<String> tokenIds = tokens.stream().map(AuthenticationToken::getTokenId).collect(Collectors.toList());
for (String tokenId : tokenIds) {
assertThat(repository.containsToken(tokenId), is(true));
}
repository.deleteTokens(tokenIds);
for (String tokenId : tokenIds) {
assertThat(repository.containsToken(tokenId), is(false));
}
List<AuthenticationToken> tokensBelongingTo = repository.getTokensBelongingTo(ownerId);
assertThat(tokensBelongingTo, is(empty()));
}
Aggregations