Search in sources :

Example 1 with AggregationDataStoreTestHarness

use of com.yahoo.elide.datastores.aggregation.framework.AggregationDataStoreTestHarness in project elide by yahoo.

the class AggregationDataStoreIntegrationTest method createHarness.

@Override
protected DataStoreTestHarness createHarness() {
    HikariConfig config = new HikariConfig(File.separator + "jpah2db.properties");
    DataSource defaultDataSource = new HikariDataSource(config);
    SQLDialect defaultDialect = SQLDialectFactory.getDefaultDialect();
    ConnectionDetails defaultConnectionDetails = new ConnectionDetails(defaultDataSource, defaultDialect);
    Properties prop = new Properties();
    prop.put("javax.persistence.jdbc.driver", config.getDriverClassName());
    prop.put("javax.persistence.jdbc.url", config.getJdbcUrl());
    EntityManagerFactory emf = Persistence.createEntityManagerFactory("aggregationStore", prop);
    Map<String, ConnectionDetails> connectionDetailsMap = new HashMap<>();
    // Add an entry for "mycon" connection which is not from hjson
    connectionDetailsMap.put("mycon", defaultConnectionDetails);
    // Add connection details fetched from hjson
    VALIDATOR.getElideSQLDBConfig().getDbconfigs().forEach(dbConfig -> connectionDetailsMap.put(dbConfig.getName(), new ConnectionDetails(getDataSource(dbConfig, getDBPasswordExtractor()), SQLDialectFactory.getDialect(dbConfig.getDialect()))));
    return new AggregationDataStoreTestHarness(emf, defaultConnectionDetails, connectionDetailsMap, VALIDATOR);
}
Also used : AggregationDataStoreTestHarness(com.yahoo.elide.datastores.aggregation.framework.AggregationDataStoreTestHarness) HikariDataSource(com.zaxxer.hikari.HikariDataSource) HashMap(java.util.HashMap) SQLDialect(com.yahoo.elide.datastores.aggregation.queryengines.sql.dialects.SQLDialect) EntityManagerFactory(javax.persistence.EntityManagerFactory) ConnectionDetails(com.yahoo.elide.datastores.aggregation.queryengines.sql.ConnectionDetails) HikariConfig(com.zaxxer.hikari.HikariConfig) Properties(java.util.Properties) HikariDataSource(com.zaxxer.hikari.HikariDataSource) DataSource(javax.sql.DataSource)

Example 2 with AggregationDataStoreTestHarness

use of com.yahoo.elide.datastores.aggregation.framework.AggregationDataStoreTestHarness in project elide by yahoo.

the class MetaDataStoreIntegrationTest method createHarness.

@Override
protected DataStoreTestHarness createHarness() {
    HikariConfig config = new HikariConfig(File.separator + "jpah2db.properties");
    DataSource defaultDataSource = new HikariDataSource(config);
    SQLDialect defaultDialect = SQLDialectFactory.getDefaultDialect();
    ConnectionDetails defaultConnectionDetails = new ConnectionDetails(defaultDataSource, defaultDialect);
    Properties prop = new Properties();
    prop.put("javax.persistence.jdbc.driver", config.getDriverClassName());
    prop.put("javax.persistence.jdbc.url", config.getJdbcUrl());
    EntityManagerFactory emf = Persistence.createEntityManagerFactory("aggregationStore", prop);
    Map<String, ConnectionDetails> connectionDetailsMap = new HashMap<>();
    // Add an entry for "mycon" connection which is not from hjson
    connectionDetailsMap.put("mycon", defaultConnectionDetails);
    // Add connection details fetched from hjson
    VALIDATOR.getElideSQLDBConfig().getDbconfigs().forEach(dbConfig -> connectionDetailsMap.put(dbConfig.getName(), new ConnectionDetails(getDataSource(dbConfig, getDBPasswordExtractor()), SQLDialectFactory.getDialect(dbConfig.getDialect()))));
    return new AggregationDataStoreTestHarness(emf, defaultConnectionDetails, connectionDetailsMap, VALIDATOR);
}
Also used : AggregationDataStoreTestHarness(com.yahoo.elide.datastores.aggregation.framework.AggregationDataStoreTestHarness) HikariDataSource(com.zaxxer.hikari.HikariDataSource) HashMap(java.util.HashMap) SQLDialect(com.yahoo.elide.datastores.aggregation.queryengines.sql.dialects.SQLDialect) EntityManagerFactory(javax.persistence.EntityManagerFactory) ConnectionDetails(com.yahoo.elide.datastores.aggregation.queryengines.sql.ConnectionDetails) HikariConfig(com.zaxxer.hikari.HikariConfig) Properties(java.util.Properties) DataSource(javax.sql.DataSource) HikariDataSource(com.zaxxer.hikari.HikariDataSource) AggregationDataStoreIntegrationTest.getDataSource(com.yahoo.elide.datastores.aggregation.integration.AggregationDataStoreIntegrationTest.getDataSource)

Aggregations

AggregationDataStoreTestHarness (com.yahoo.elide.datastores.aggregation.framework.AggregationDataStoreTestHarness)2 ConnectionDetails (com.yahoo.elide.datastores.aggregation.queryengines.sql.ConnectionDetails)2 SQLDialect (com.yahoo.elide.datastores.aggregation.queryengines.sql.dialects.SQLDialect)2 HikariConfig (com.zaxxer.hikari.HikariConfig)2 HikariDataSource (com.zaxxer.hikari.HikariDataSource)2 HashMap (java.util.HashMap)2 Properties (java.util.Properties)2 EntityManagerFactory (javax.persistence.EntityManagerFactory)2 DataSource (javax.sql.DataSource)2 AggregationDataStoreIntegrationTest.getDataSource (com.yahoo.elide.datastores.aggregation.integration.AggregationDataStoreIntegrationTest.getDataSource)1