Search in sources :

Example 21 with AuthenticationToken

use of tech.aroma.thrift.authentication.AuthenticationToken in project aroma-data-operations by RedRoma.

the class MemoryTokenRepositoryTest method testGetToken.

@Test
public void testGetToken() throws Exception {
    assertThrows(() -> repository.getToken(tokenId)).isInstanceOf(InvalidTokenException.class);
    repository.saveToken(token);
    AuthenticationToken result = repository.getToken(tokenId);
    assertThat(result, is(token));
}
Also used : AuthenticationToken(tech.aroma.thrift.authentication.AuthenticationToken) Test(org.junit.Test)

Example 22 with AuthenticationToken

use of tech.aroma.thrift.authentication.AuthenticationToken in project aroma-data-operations by RedRoma.

the class MemoryTokenRepositoryTest method testGetTokensBelongingTo.

@Test
public void testGetTokensBelongingTo() throws Exception {
    for (AuthenticationToken token : tokens) {
        repository.saveToken(token);
    }
    List<AuthenticationToken> result = repository.getTokensBelongingTo(ownerId);
    Set<AuthenticationToken> expected = Sets.newHashSet(tokens);
    Set<AuthenticationToken> resultSet = Sets.newHashSet(result);
    assertThat(resultSet, is(expected));
}
Also used : AuthenticationToken(tech.aroma.thrift.authentication.AuthenticationToken) Test(org.junit.Test)

Aggregations

AuthenticationToken (tech.aroma.thrift.authentication.AuthenticationToken)22 Test (org.junit.Test)14 BatchStatement (com.datastax.driver.core.BatchStatement)4 Row (com.datastax.driver.core.Row)4 Statement (com.datastax.driver.core.Statement)4 InvalidArgumentException (tech.aroma.thrift.exceptions.InvalidArgumentException)3 InvalidTokenException (tech.aroma.thrift.exceptions.InvalidTokenException)3 ResultSet (com.datastax.driver.core.ResultSet)2 TException (org.apache.thrift.TException)2 OperationFailedException (tech.aroma.thrift.exceptions.OperationFailedException)2 IntegrationTest (tech.sirwellington.alchemy.annotations.testing.IntegrationTest)2 StringAssertions.nonEmptyString (tech.sirwellington.alchemy.arguments.assertions.StringAssertions.nonEmptyString)2 StringGenerators.hexadecimalString (tech.sirwellington.alchemy.generator.StringGenerators.hexadecimalString)2 Cluster (com.datastax.driver.core.Cluster)1 Session (com.datastax.driver.core.Session)1 Map (java.util.Map)1 Set (java.util.Set)1 UUID (java.util.UUID)1 Function (java.util.function.Function)1 Collectors.toSet (java.util.stream.Collectors.toSet)1