package com.palantir.atlasdb.keyvalue.rdbms;

import javax.sql.DataSource;

import org.postgresql.jdbc2.optional.PoolingDataSource;

import com.palantir.atlasdb.keyvalue.api.KeyValueService;
import com.palantir.atlasdb.keyvalue.impl.AbstractAtlasDbKeyValueServiceTest;

public class PostgresKeyValueServiceTest extends AbstractAtlasDbKeyValueServiceTest {

    private KeyValueService kvs;

    public static DataSource getTestPostgresDataSource() {
        PoolingDataSource pgDataSource = new PoolingDataSource();
        pgDataSource.setDatabaseName("test");
        pgDataSource.setUser("test");
        pgDataSource.setPassword("password");
        return pgDataSource;
    }

    @Override
    protected KeyValueService getKeyValueService() {
        if (kvs == null) {
            KeyValueService ret = new PostgresKeyValueService(getTestPostgresDataSource());
            ret.initializeFromFreshInstance();
            kvs = ret;
        }
        return kvs;
    }

}

@@ -675,16 +675,244 @@
 %0A    %7D%0A%0A
+    public static PostgresKeyValueService newTestInstance() %7B%0A        PostgresKeyValueService ret = new PostgresKeyValueService(getTestPostgresDataSource());%0A        ret.initializeFromFreshInstance();%0A        return ret;%0A    %7D%0A%0A
     @Ove

Add convinience method for Postgres test instance.