Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove MySQL Connector #3294

Merged
merged 11 commits into from
Mar 5, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ import edu.uci.ics.amber.core.workflow.PortIdentity
import edu.uci.ics.texera.workflow.LogicalLink
import org.scalatest.flatspec.AnyFlatSpecLike
import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach}

import java.sql.PreparedStatement
import scala.concurrent.duration.DurationInt

class DataProcessingSpec
Expand Down Expand Up @@ -108,40 +106,6 @@ class DataProcessingSpec
results
}

def initializeInMemoryMySQLInstance(): (String, String, String, String, String, String) = {
import ch.vorburger.mariadb4j.{DB, DBConfigurationBuilder}

import java.sql.DriverManager

val database: String = "new"
val table: String = "test"
val username: String = "root"
val password: String = ""
val driver = new com.mysql.cj.jdbc.Driver()
DriverManager.registerDriver(driver)

val config = DBConfigurationBuilder.newBuilder
.setPort(0) // 0 => automatically detect free port
.build()

inMemoryMySQLInstance = Option(DB.newEmbeddedDB(config))
inMemoryMySQLInstance.get.start()
inMemoryMySQLInstance.get.createDB(database)

// insert test data
val conn = DriverManager.getConnection(config.getURL(database), username, password)
var statement: PreparedStatement = conn.prepareStatement(
s"create table $table (id int primary key auto_increment, text VARCHAR(512), " +
s"point FLOAT, created_at DATE default NOW() not null)"
)
statement.execute()
statement = conn.prepareStatement(s"insert into $table (text) values ('hello world')")
statement.execute()
statement.close()
conn.close()
("localhost", config.getPort.toString, database, table, username, password)
}

"Engine" should "execute headerlessCsv workflow normally" in {
val headerlessCsvOpDesc = TestOperators.headerlessSmallCsvScanOpDesc()
val workflow = buildWorkflow(
Expand Down Expand Up @@ -342,37 +306,4 @@ class DataProcessingSpec
)
executeWorkflow(workflow)
}

// TODO: use mock data to perform the test, remove dependency on the real AsterixDB
// "Engine" should "execute asterixdb workflow normally" in {
//
// val asterixDBOp = TestOperators.asterixDBSourceOpDesc()
// val (id, workflow) = buildWorkflow(
// List(asterixDBOp),
// List()
// )
// executeWorkflow(id, workflow)
// }

"Engine" should "execute mysql workflow normally" in {
val (host, port, database, table, username, password) = initializeInMemoryMySQLInstance()
val inMemoryMsSQLSourceOpDesc = TestOperators.inMemoryMySQLSourceOpDesc(
host,
port,
database,
table,
username,
password
)

val workflow = buildWorkflow(
List(inMemoryMsSQLSourceOpDesc),
List(),
workflowContext
)
executeWorkflow(workflow)

inMemoryMySQLInstance.get.stop()
}

}
1 change: 0 additions & 1 deletion core/dao/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ libraryDependencies ++= Seq(
/////////////////////////////////////////////////////////////////////////////

libraryDependencies ++= Seq(
"mysql" % "mysql-connector-java" % "8.0.33", // MySQL connector
"org.postgresql" % "postgresql" % "42.7.4",
"org.yaml" % "snakeyaml" % "1.30", // for reading storage config yaml file
)
Loading