11package eu .neverblink .jelly .cli .command
22
3- import caseapp .core .{Indexed , RemainingArgs }
43import eu .neverblink .jelly .cli .command .helpers .*
54import eu .neverblink .jelly .cli .command .rdf .*
65import org .apache .jena .riot .RDFLanguages
@@ -11,37 +10,34 @@ import scala.io.Source
1110import scala .util .Using
1211
1312class RdfFromJellySpec extends AnyWordSpec with Matchers with CleanUpAfterTest :
13+
1414 " rdf from-jelly command" should {
1515 " be able to convert a Jelly file to NTriples output stream" in {
1616 val jellyFile = DataGenHelper .generateJellyFile(3 )
1717 val nQuadString = DataGenHelper .generateNQuadString(3 )
18- val options = RdfFromJellyOptions (outputFile = None )
19- val args = RemainingArgs (indexedRemaining = List (Indexed (jellyFile)), Seq .empty)
2018 val (out, err) =
21- RdfFromJelly .runTest(
22- options,
23- args,
24- )
19+ RdfFromJelly .runCommand(List (" rdf" , " from-jelly" , jellyFile))
2520 val sortedOut = out.split(" \n " ).map(_.trim).sorted
2621 val sortedQuads = nQuadString.split(" \n " ).map(_.trim).sorted
2722 sortedOut should contain theSameElementsAs sortedQuads
2823 }
24+
2925 " be able to convert a Jelly stream to NTriples output stream" in {
3026 DataGenHelper .generateJellyInputStream(3 )
3127 val nQuadString = DataGenHelper .generateNQuadString(3 )
32- val options = RdfFromJellyOptions (outputFile = None )
33- val (out, err) = RdfFromJelly .runTest(options)
28+ val (out, err) = RdfFromJelly .runCommand(List (" rdf" , " from-jelly" ))
3429 val sortedOut = out.split(" \n " ).map(_.trim).sorted
3530 val sortedQuads = nQuadString.split(" \n " ).map(_.trim).sorted
3631 sortedOut should contain theSameElementsAs sortedQuads
3732 }
3833 " be able to convert a Jelly file to NTriples file" in {
3934 val jellyFile = DataGenHelper .generateJellyFile(3 )
40- val args = RemainingArgs (indexedRemaining = List (Indexed (jellyFile)), Seq .empty)
4135 val nQuadString = DataGenHelper .generateNQuadString(3 )
4236 val outputFile = DataGenHelper .generateOutputFile(RDFLanguages .NQUADS )
43- val options = RdfFromJellyOptions (outputFile = Some (outputFile))
44- val (out, err) = RdfFromJelly .runTest(options, args)
37+ val (out, err) =
38+ RdfFromJelly .runCommand(
39+ List (" rdf" , " from-jelly" , jellyFile, " --to" , outputFile),
40+ )
4541 val sortedOut = Using .resource(Source .fromFile(outputFile)) { content =>
4642 content.getLines().toList.map(_.trim).sorted
4743 }
@@ -53,8 +49,8 @@ class RdfFromJellySpec extends AnyWordSpec with Matchers with CleanUpAfterTest:
5349 DataGenHelper .generateJellyInputStream(3 )
5450 val outputFile = DataGenHelper .generateOutputFile(RDFLanguages .NQUADS )
5551 val nQuadString = DataGenHelper .generateNQuadString(3 )
56- val options = RdfFromJellyOptions (outputFile = Some (outputFile))
57- val (out, err) = RdfFromJelly .runTest(options )
52+ val (out, err) =
53+ RdfFromJelly .runCommand( List ( " rdf " , " from-jelly " , " --to " , outputFile) )
5854 val sortedOut = Using .resource(Source .fromFile(outputFile)) { content =>
5955 content.getLines().toList.map(_.trim).sorted
6056 }
0 commit comments