Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
julianpeeters committed Aug 6, 2024
1 parent ff34f9c commit 6f3d632
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private[avrohugger] object StringGenerator {
typeMatcher,
restrictedFields,
targetScalaPartialVersion)
compilationUnits.map(compUnit => removeExtraWarning(compUnit.codeString)).distinct
compilationUnits.map(compUnit => removeExtraWarning(compUnit.codeString))
}

def stringToStrings(
Expand Down Expand Up @@ -113,7 +113,7 @@ private[avrohugger] object StringGenerator {
case Right(protocol) => {
protocolToStrings(protocol, format, classStore, schemaStore, typeMatcher, restrictedFields, targetScalaPartialVersion)
}
}).distinct
})
}
catch {
case ex: FileNotFoundException => sys.error("File not found:" + ex)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ class FileInputParser {
case "avdl" =>
val idl = new IdlReader().parse(infile.toPath())
val protocol = idl.getProtocol()
// /**
// * IDLs may refer to types imported from another file. When converted
// * to protocols, the imported types that share the IDL's namespace
// * cannot be distinguished from types defined within the IDL, yet
// * should not be generated as subtypes of the IDL's ADT and should
// * instead be generated in its own namespace. So, strip the protocol
// * of all imported types and generate them separately.
// */
/**
* IDLs may refer to types imported from another file. When converted
* to protocols, the imported types that share the IDL's namespace
* cannot be distinguished from types defined within the IDL, yet
* should not be generated as subtypes of the IDL's ADT and should
* instead be generated in its own namespace. So, strip the protocol
* of all imported types and generate them separately.
*/
val importedFiles = IdlImportParser.getImportedFiles(infile, classLoader)
val importedSchemaOrProtocols = importedFiles.flatMap(file => {
val importParser = new Parser() // else attempts to redefine schemas
Expand Down
44 changes: 22 additions & 22 deletions avrohugger-tools/src/test/scala/StandardGeneratorToolSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,37 @@ class StandardGeneratorToolSpec extends mutable.Specification {
}
}

// "match the expected single protocol file" in {
// doCompile(List[String] ("protocol",
// Directory.TEST_INPUT_DIR + "/mail.avpr",
// Directory.TEST_OUTPUT_BASE_DIR
// ))
// Util.readFile(Directory.TEST_OUTPUT_MESSAGE) === Util.readFile(Directory.TEST_EXPECTED_MESSAGE)
// }
"match the expected single protocol file" in {
doCompile(List[String] ("protocol",
Directory.TEST_INPUT_DIR + "/mail.avpr",
Directory.TEST_OUTPUT_BASE_DIR
))
Util.readFile(Directory.TEST_OUTPUT_MESSAGE) === Util.readFile(Directory.TEST_EXPECTED_MESSAGE)
}

// "match the expected single datafile file" in {
// doCompile(List[String] ("datafile",
// Directory.TEST_INPUT_DIR + "/twitter.avro",
// Directory.TEST_OUTPUT_BASE_DIR
// ))
// Util.readFile(Directory.TEST_OUTPUT_TWITTER) === Util.readFile(Directory.TEST_EXPECTED_TWITTER)
// }
"match the expected single datafile file" in {
doCompile(List[String] ("datafile",
Directory.TEST_INPUT_DIR + "/twitter.avro",
Directory.TEST_OUTPUT_BASE_DIR
))
Util.readFile(Directory.TEST_OUTPUT_TWITTER) === Util.readFile(Directory.TEST_EXPECTED_TWITTER)
}

// "match the expected single schema file" in {
// doCompile(List[String] ("schema",
// Directory.TEST_INPUT_DIR + "/handle.avsc",
// Directory.TEST_OUTPUT_BASE_DIR
// ))
// Util.readFile(Directory.TEST_OUTPUT_HANDLE) === Util.readFile(Directory.TEST_EXPECTED_HANDLE)
// }
"match the expected single schema file" in {
doCompile(List[String] ("schema",
Directory.TEST_INPUT_DIR + "/handle.avsc",
Directory.TEST_OUTPUT_BASE_DIR
))
Util.readFile(Directory.TEST_OUTPUT_HANDLE) === Util.readFile(Directory.TEST_EXPECTED_HANDLE)
}

"match the expected dependent files" in {
doCompile(List[String]("schema",
Directory.TEST_INPUT_DIR + "/handle.avsc",
Directory.TEST_INPUT_DIR + "/pilot.avsc",
Directory.TEST_OUTPUT_BASE_DIR
))
// Util.readFile(Directory.TEST_OUTPUT_HANDLE) === Util.readFile(Directory.TEST_EXPECTED_HANDLE)
Util.readFile(Directory.TEST_OUTPUT_HANDLE) === Util.readFile(Directory.TEST_EXPECTED_HANDLE)
Util.readFile(Directory.TEST_OUTPUT_PILOT) === Util.readFile(Directory.TEST_EXPECTED_PILOT)
}

Expand Down

0 comments on commit 6f3d632

Please sign in to comment.