Skip to content

Commit

Permalink
Add a few complex test cases for BasicStore
Browse files Browse the repository at this point in the history
  • Loading branch information
alekslitvinenk committed Jan 5, 2025
1 parent 2c6be32 commit c1e010d
Show file tree
Hide file tree
Showing 2 changed files with 1,000 additions and 920 deletions.
29 changes: 28 additions & 1 deletion src/test/scala/io/dockovpn/metastore/TestData.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ object TestData {
val OptLongRecordClass: String = getType[OptLongRecord].toString.replace("TestData.", "TestData$")
val OptStringRecordClass: String = getType[OptStringRecord].toString.replace("TestData.", "TestData$")
val OptTimestampRecordClass: String = getType[OptTimestampRecord].toString.replace("TestData.", "TestData$")
//val ComplexTestRecordClass: String = getType[ComplexTestRecord].toString.replace("TestData.", "TestData$")
val ComplexTestRecordClass: String = getType[ComplexTestRecord].toString.replace("TestData.", "TestData$")

tag.runtimeClass.getName match {
case IntRecordClass =>
Expand Down Expand Up @@ -113,6 +113,14 @@ object TestData {
OptTimestampRecord(r.<<, r.<<)
}
)
case ComplexTestRecordClass =>
new TableMetadata(
tableName = "complex_test_record",
fieldName = "id",
rconv = GetResult { r =>
ComplexTestRecord(r.<<, r.<<, r.<<, r.<<, r.<<, r.<<, r.<<, r.<<, r.<<)
}
)
case unrecognizedType =>
throw new IllegalArgumentException(s"Unrecognized type [$unrecognizedType] to get TableMetadata for")
}
Expand Down Expand Up @@ -190,6 +198,21 @@ object TestData {
|) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|""".stripMargin.as[Unit]
},
dbRef.run {
sql"""CREATE TABLE `complex_test_record` (
| id varchar(100) NOT NULL,
| int_value INT NOT NULL,
| long_value BIGINT NOT NULL,
| string_value varchar(100) NOT NULL,
| timestamp_value TIMESTAMP(6) NOT NULL,
| opt_int_value INT NULL,
| opt_long_value BIGINT NULL,
| opt_string_value varchar(100) NULL,
| opt_timestamp_value TIMESTAMP(6) NULL,
| CONSTRAINT complex_test_record_PK PRIMARY KEY (id)
|) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|""".stripMargin.as[Unit]
},
)).map(_ => ())
}

Expand Down Expand Up @@ -227,6 +250,10 @@ object TestData {
sql"""TRUNCATE TABLE opt_timestamp_records
|""".stripMargin.as[Unit]
},
dbRef.run {
sql"""TRUNCATE TABLE complex_test_record
|""".stripMargin.as[Unit]
},
)).map(_ => ())
}
}
Expand Down
Loading

0 comments on commit c1e010d

Please sign in to comment.