Skip to content

Commit

Permalink
Use MongoDB and HSQLDB in MqlGeoFunctionsTest (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
murermader committed Aug 23, 2024
1 parent f62a83d commit cf7faa0
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dbms/src/test/java/org/polypheny/db/TestHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,12 @@ public static void addHsqldb( String name, Statement statement ) throws SQLExcep
}


public static void addMongodb( String name, Statement statement ) throws SQLException {
executeSQL( statement, "ALTER ADAPTERS ADD \"" + name + "\" USING 'mongodb' AS 'Store'"
+ " WITH '{maxConnections:\"25\",trxControlMode:locks,trxIsolationLevel:read_committed,type:Memory,tableType:Memory,mode:embedded}'" );
}


public static void addCsv( String name, Statement statement ) throws SQLException {
executeSQL( statement, "ALTER ADAPTERS ADD \"" + name + "\" USING 'Csv' AS 'Store'"
+ " WITH '{}'" );
Expand Down
34 changes: 34 additions & 0 deletions dbms/src/test/java/org/polypheny/db/mql/MqlGeoFunctionsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,51 @@

package org.polypheny.db.mql;

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.polypheny.db.TestHelper;
import org.polypheny.db.TestHelper.JdbcConnection;
import org.polypheny.db.webui.models.results.DocResult;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

import static org.junit.jupiter.api.Assertions.assertEquals;

@SuppressWarnings("SqlNoDataSourceInspection")
@Tag("adapter")
public class MqlGeoFunctionsTest extends MqlTestTemplate {

final static String collectionName = "doc";
final static String mongoAdapterName = "mongo";

@BeforeAll
public static void start() {
// Ensures that Polypheny-DB is running
TestHelper.getInstance();

try ( JdbcConnection polyphenyDbConnection = new JdbcConnection( true ) ) {
Connection connection = polyphenyDbConnection.getConnection();
try ( Statement statement = connection.createStatement() ) {
// TestHelper.addHsqldb(mongoAdapterName, statement);
TestHelper.addMongodb( mongoAdapterName, statement );
}
} catch ( SQLException e ) {
throw new RuntimeException( e );
}
}


@BeforeEach
public void beforeEach() {
// Clear both DBs before each test
String deleteCollection = "db.%s.deleteMany({})".formatted( collectionName );
execute(deleteCollection);
execute(deleteCollection, mongoAdapterName);
}


@Test
Expand Down

0 comments on commit cf7faa0

Please sign in to comment.