use of org.eclipse.dataspaceconnector.sql.policy.store.PostgressStatements in project DataSpaceConnector by eclipse-dataspaceconnector.
the class SqlPolicyStoreTest method setUp.
@BeforeEach
void setUp() throws SQLException, IOException {
var transactionContext = new NoopTransactionContext();
DataSourceRegistry dataSourceRegistry = mock(DataSourceRegistry.class);
var jdbcDataSource = new JdbcDataSource();
jdbcDataSource.setURL("jdbc:h2:mem:");
// do not actually close
connection = spy(jdbcDataSource.getConnection());
doNothing().when(connection).close();
var datasourceMock = mock(DataSource.class);
when(datasourceMock.getConnection()).thenReturn(connection);
when(dataSourceRegistry.resolve(DATASOURCE_NAME)).thenReturn(datasourceMock);
sqlPolicyStore = new SqlPolicyStore(dataSourceRegistry, DATASOURCE_NAME, transactionContext, new TypeManager(), new PostgressStatements());
var schema = Files.readString(Paths.get("./docs/schema.sql"));
transactionContext.execute(() -> SqlQueryExecutor.executeQuery(connection, schema));
}
Aggregations