File tree Expand file tree Collapse file tree
main/kotlin/com/github/mgramin/sqlboot/model/resourcetype
test/kotlin/com/github/mgramin/sqlboot/model/resourcetype/impl Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,7 +63,6 @@ interface ResourceType {
6363 @JsonProperty
6464 fun metaData (): Map <String , String >
6565
66- // @JvmDefault
6766 fun metaData (uri : Uri ): List <Metadata > {
6867 return metaData().entries
6968 .map { e -> Metadata (e.key, e.value) }
Original file line number Diff line number Diff line change @@ -84,15 +84,11 @@ class FsResourceType(
8484 }
8585
8686 override fun read (uri : Uri ): Flux <DbResource > {
87- try {
88- return Flux .merge(
89- resourceTypes
90- .filter { v -> v.name().matches(uri.type().replace(" ?" , " .?" ).replace(" *" , " .*?" ).toRegex()) }
91- .map { it.read(uri) }
92- .toList())
93- } catch (e: Exception ) {
94- throw BootException (" Type not found" , 404 )
95- }
87+ return Flux .merge(
88+ resourceTypes
89+ .filter { v -> v.name().matches(uri.type().replace(" ?" , " .?" ).replace(" *" , " .*?" ).toRegex()) }
90+ .map { it.read(uri) }
91+ .toList())
9692 }
9793
9894 override fun metaData (): Map <String , String > {
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ package com.github.mgramin.sqlboot.model.resourcetype.impl
2626
2727import com.github.mgramin.sqlboot.exceptions.BootException
2828import com.github.mgramin.sqlboot.model.connection.SimpleDbConnection
29+ import com.github.mgramin.sqlboot.model.resourcetype.Metadata
2930import com.github.mgramin.sqlboot.model.uri.impl.DbUri
3031import com.github.mgramin.sqlboot.model.uri.impl.FakeUri
3132import org.junit.jupiter.api.Assertions.assertEquals
@@ -89,9 +90,17 @@ class FsResourceTypeTest {
8990 assertThrows(BootException ::class .java) { FsResourceType (listOf (db), FakeUri ()).path() }
9091 }
9192
92- @Test
93- fun metaData () {
94- // assertThrows(BootException::class.java) { FsResourceType(listOf(db), FakeUri()).metaData() }
93+ @ParameterizedTest
94+ @CsvSource(
95+ " prod/sessions,7" ,
96+ " prod/schema,9" ,
97+ // "prod/s*,5",
98+ // "prod/tab*/bookings,5",
99+ " prod/table/bookings,6" ,
100+ " prod/table/bookings.airports,6" )
101+ fun metaData (uri : String , count : Int ) {
102+ val metaData: List <Metadata > = FsResourceType (listOf (db), DbUri (uri)).metaData(DbUri (uri))
103+ assertEquals(count, metaData.count())
95104 }
96105
97106}
You can’t perform that action at this time.
0 commit comments