package org.rakam.aws.dynamodb;

import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.eventbus.EventBus;
import io.airlift.log.Logger;
import org.rakam.analysis.metadata.AbstractMetastore;
import org.rakam.aws.AWSConfig;
import org.rakam.aws.DynamodbUtil;
import org.rakam.aws.dynamodb.metastore.DynamodbMetastore;
import org.rakam.aws.dynamodb.metastore.DynamodbMetastoreConfig;
import org.rakam.collection.FieldDependencyBuilder;
import org.rakam.collection.TestMetastore;
import org.testng.annotations.AfterSuite;

public class TestDynamodbMetastore
        extends TestMetastore
{
    private final DynamodbMetastore metastore;
    private final DynamodbUtil.DynamodbProcess dynamodbProcess;

    public TestDynamodbMetastore()
            throws Exception
    {
        dynamodbProcess = DynamodbUtil.createDynamodbProcess();
        metastore = new DynamodbMetastore(new AWSConfig().setDynamodbEndpoint("http://127.0.0.1:" + dynamodbProcess.port),
                new DynamodbMetastoreConfig(),
                new FieldDependencyBuilder.FieldDependency(ImmutableSet.of(), ImmutableMap.of()),
                new EventBus());
        metastore.setup();
    }

    @Override
    public AbstractMetastore getMetastore()
    {
        return metastore;
    }

    @AfterSuite
    public void tearDown()
            throws Exception
    {
        metastore.deleteTable();
        dynamodbProcess.process.destroy();
    }
}

@@ -902,57 +902,59 @@
     
-metastore = new DynamodbMetastore(new AWSConfig()
+AWSConfig config = new AWSConfig()%0A                
 .set
@@ -1013,16 +1013,148 @@
 ss.port)
+%0A                .setAccessKey(%22test%22)%0A                .setSecretAccessKey(%22test%22);%0A        metastore = new DynamodbMetastore(config
 ,%0A      

Set random access keys in Dynamodb metastore test