Search in sources :

Example 6 with LocalKeyFactory

use of com.amazonaws.athena.connector.lambda.security.LocalKeyFactory in project aws-athena-query-federation by awslabs.

the class TPCDSMetadataHandlerTest method setUp.

@Before
public void setUp() throws Exception {
    handler = new TPCDSMetadataHandler(new LocalKeyFactory(), mockSecretsManager, mockAthena, "spillBucket", "spillPrefix");
    allocator = new BlockAllocatorImpl();
}
Also used : BlockAllocatorImpl(com.amazonaws.athena.connector.lambda.data.BlockAllocatorImpl) LocalKeyFactory(com.amazonaws.athena.connector.lambda.security.LocalKeyFactory) Before(org.junit.Before)

Example 7 with LocalKeyFactory

use of com.amazonaws.athena.connector.lambda.security.LocalKeyFactory in project aws-athena-query-federation by awslabs.

the class VerticaMetadataHandlerTest method setUp.

@Before
public void setUp() throws SQLException {
    this.verticaConnectionFactory = Mockito.mock(VerticaConnectionFactory.class);
    this.verticaSchemaUtils = Mockito.mock(VerticaSchemaUtils.class);
    this.queryFactory = Mockito.mock(QueryFactory.class);
    this.verticaExportQueryBuilder = Mockito.mock(VerticaExportQueryBuilder.class);
    this.connection = Mockito.mock(Connection.class, Mockito.RETURNS_DEEP_STUBS);
    this.secretsManager = Mockito.mock(AWSSecretsManager.class);
    this.athena = Mockito.mock(AmazonAthena.class);
    this.federatedIdentity = Mockito.mock(FederatedIdentity.class);
    this.databaseMetaData = Mockito.mock(DatabaseMetaData.class);
    this.tableName = Mockito.mock(TableName.class);
    this.schema = Mockito.mock(Schema.class);
    this.constraints = Mockito.mock(Constraints.class);
    this.schemaBuilder = Mockito.mock(SchemaBuilder.class);
    this.blockWriter = Mockito.mock(BlockWriter.class);
    this.queryStatusChecker = Mockito.mock(QueryStatusChecker.class);
    this.amazonS3 = Mockito.mock(AmazonS3.class);
    Mockito.when(this.secretsManager.getSecretValue(Mockito.eq(new GetSecretValueRequest().withSecretId("testSecret")))).thenReturn(new GetSecretValueResult().withSecretString("{\"username\": \"testUser\", \"password\": \"testPassword\"}"));
    Mockito.when(this.verticaConnectionFactory.getOrCreateConn(anyString())).thenReturn(connection);
    Mockito.when(connection.getMetaData()).thenReturn(databaseMetaData);
    Mockito.when(amazonS3.getRegion()).thenReturn(Region.US_West_2);
    this.verticaMetadataHandler = new VerticaMetadataHandler(new LocalKeyFactory(), verticaConnectionFactory, secretsManager, athena, "spill-bucket", "spill-prefix", verticaSchemaUtils, amazonS3);
    this.allocator = new BlockAllocatorImpl();
    this.databaseMetaData = this.connection.getMetaData();
    verticaMetadataHandlerMocked = Mockito.spy(this.verticaMetadataHandler);
}
Also used : AmazonS3(com.amazonaws.services.s3.AmazonS3) QueryFactory(com.amazonaws.athena.connectors.vertica.query.QueryFactory) AWSSecretsManager(com.amazonaws.services.secretsmanager.AWSSecretsManager) Schema(org.apache.arrow.vector.types.pojo.Schema) LocalKeyFactory(com.amazonaws.athena.connector.lambda.security.LocalKeyFactory) TableName(com.amazonaws.athena.connector.lambda.domain.TableName) Constraints(com.amazonaws.athena.connector.lambda.domain.predicate.Constraints) GetSecretValueResult(com.amazonaws.services.secretsmanager.model.GetSecretValueResult) VerticaExportQueryBuilder(com.amazonaws.athena.connectors.vertica.query.VerticaExportQueryBuilder) FederatedIdentity(com.amazonaws.athena.connector.lambda.security.FederatedIdentity) QueryStatusChecker(com.amazonaws.athena.connector.lambda.QueryStatusChecker) GetSecretValueRequest(com.amazonaws.services.secretsmanager.model.GetSecretValueRequest) AmazonAthena(com.amazonaws.services.athena.AmazonAthena) Before(org.junit.Before)

Example 8 with LocalKeyFactory

use of com.amazonaws.athena.connector.lambda.security.LocalKeyFactory in project aws-athena-query-federation by awslabs.

the class CloudwatchMetadataHandlerTest method setUp.

@Before
public void setUp() throws Exception {
    when(mockAwsLogs.describeLogStreams(any(DescribeLogStreamsRequest.class))).thenAnswer((InvocationOnMock invocationOnMock) -> {
        return new DescribeLogStreamsResult().withLogStreams(new LogStream().withLogStreamName("table-9"), new LogStream().withLogStreamName("table-10"));
    });
    when(mockAwsLogs.describeLogGroups(any(DescribeLogGroupsRequest.class))).thenAnswer((InvocationOnMock invocationOnMock) -> {
        return new DescribeLogGroupsResult().withLogGroups(new LogGroup().withLogGroupName("schema-1"), new LogGroup().withLogGroupName("schema-20"));
    });
    handler = new CloudwatchMetadataHandler(mockAwsLogs, new LocalKeyFactory(), mockSecretsManager, mockAthena, "spillBucket", "spillPrefix");
    allocator = new BlockAllocatorImpl();
}
Also used : DescribeLogGroupsResult(com.amazonaws.services.logs.model.DescribeLogGroupsResult) LogGroup(com.amazonaws.services.logs.model.LogGroup) BlockAllocatorImpl(com.amazonaws.athena.connector.lambda.data.BlockAllocatorImpl) InvocationOnMock(org.mockito.invocation.InvocationOnMock) DescribeLogStreamsRequest(com.amazonaws.services.logs.model.DescribeLogStreamsRequest) LogStream(com.amazonaws.services.logs.model.LogStream) DescribeLogStreamsResult(com.amazonaws.services.logs.model.DescribeLogStreamsResult) DescribeLogGroupsRequest(com.amazonaws.services.logs.model.DescribeLogGroupsRequest) LocalKeyFactory(com.amazonaws.athena.connector.lambda.security.LocalKeyFactory) Before(org.junit.Before)

Example 9 with LocalKeyFactory

use of com.amazonaws.athena.connector.lambda.security.LocalKeyFactory in project aws-athena-query-federation by awslabs.

the class DocDBMetadataHandlerTest method setUp.

@Before
public void setUp() throws Exception {
    logger.info("{}: enter", testName.getMethodName());
    when(connectionFactory.getOrCreateConn(anyString())).thenReturn(mockClient);
    handler = new DocDBMetadataHandler(awsGlue, connectionFactory, new LocalKeyFactory(), secretsManager, mockAthena, "spillBucket", "spillPrefix");
    allocator = new BlockAllocatorImpl();
}
Also used : BlockAllocatorImpl(com.amazonaws.athena.connector.lambda.data.BlockAllocatorImpl) LocalKeyFactory(com.amazonaws.athena.connector.lambda.security.LocalKeyFactory) Before(org.junit.Before)

Example 10 with LocalKeyFactory

use of com.amazonaws.athena.connector.lambda.security.LocalKeyFactory in project aws-athena-query-federation by awslabs.

the class DynamoDBMetadataHandlerTest method setup.

@Before
public void setup() {
    logger.info("{}: enter", testName.getMethodName());
    TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
    allocator = new BlockAllocatorImpl();
    handler = new DynamoDBMetadataHandler(new LocalKeyFactory(), secretsManager, athena, "spillBucket", "spillPrefix", ddbClient, glueClient);
}
Also used : BlockAllocatorImpl(com.amazonaws.athena.connector.lambda.data.BlockAllocatorImpl) LocalKeyFactory(com.amazonaws.athena.connector.lambda.security.LocalKeyFactory) Before(org.junit.Before)

Aggregations

LocalKeyFactory (com.amazonaws.athena.connector.lambda.security.LocalKeyFactory)19 Before (org.junit.Before)15 BlockAllocatorImpl (com.amazonaws.athena.connector.lambda.data.BlockAllocatorImpl)14 TableName (com.amazonaws.athena.connector.lambda.domain.TableName)5 Test (org.junit.Test)4 InvocationOnMock (org.mockito.invocation.InvocationOnMock)4 QueryStatusChecker (com.amazonaws.athena.connector.lambda.QueryStatusChecker)2 Constraints (com.amazonaws.athena.connector.lambda.domain.predicate.Constraints)2 AmazonS3 (com.amazonaws.services.s3.AmazonS3)2 GetSecretValueRequest (com.amazonaws.services.secretsmanager.model.GetSecretValueRequest)2 GetSecretValueResult (com.amazonaws.services.secretsmanager.model.GetSecretValueResult)2 Field (org.apache.arrow.vector.types.pojo.Field)2 Schema (org.apache.arrow.vector.types.pojo.Schema)2 Mockito.anyString (org.mockito.Mockito.anyString)2 Block (com.amazonaws.athena.connector.lambda.data.Block)1 BlockAllocator (com.amazonaws.athena.connector.lambda.data.BlockAllocator)1 BlockWriter (com.amazonaws.athena.connector.lambda.data.BlockWriter)1 S3BlockSpillReader (com.amazonaws.athena.connector.lambda.data.S3BlockSpillReader)1 GetSplitsRequest (com.amazonaws.athena.connector.lambda.metadata.GetSplitsRequest)1 GetSplitsResponse (com.amazonaws.athena.connector.lambda.metadata.GetSplitsResponse)1