Skip to content

Commit

Permalink
Merge pull request #555 from smeup/bugfix/printer-file-precedence
Browse files Browse the repository at this point in the history
Bugfix/printer file precedence
  • Loading branch information
lanarimarco authored Jul 1, 2024
2 parents 4abb66b + 1d7bbaa commit 9352055
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,15 @@ private fun MutableMap<String, DataDefinition>.addIfNotPresent(dataDefinition: D

private fun FileDefinition.loadMetadata(): FileMetadata {
return when {
fileType == FileType.PRINTER -> {
FileMetadata(
name = this.name,
tableName = this.name,
recordFormat = this.internalFormatName ?: this.name,
fields = emptyList(),
accessFields = emptyList()
)
}
(fileType == FileType.DB || MainExecutionContext.getConfiguration().dspfConfig == null) -> {
val reloadConfig = MainExecutionContext.getConfiguration()
.reloadConfig
Expand All @@ -215,15 +224,6 @@ private fun FileDefinition.loadMetadata(): FileMetadata {
error("Not found metadata for $this", error)
}.getOrNull() ?: error("Not found metadata for $this")
}
fileType == FileType.PRINTER -> {
FileMetadata(
name = this.name,
tableName = this.name,
recordFormat = this.internalFormatName ?: this.name,
fields = emptyList(),
accessFields = emptyList()
)
}
else -> error("Unhandled file type $fileType")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,16 @@ open class MULANGT50FileAccess1Test : MULANGTTest() {
val expected = listOf("ok")
assertEquals(expected, "smeup/MUDRNRAPU00220".outputOf(configuration = smeupConfig))
}

/**
* Printer file with O-specs with no DSPF config
* @see #LS24002987
*/
@Test
fun executeMUDRNRAPU00220WithoutDSPF() {
val expected = listOf("ok")
val mockSmeupConfig = smeupConfig.copy()
mockSmeupConfig.dspfConfig = null
assertEquals(expected, "smeup/MUDRNRAPU00220".outputOf(configuration = mockSmeupConfig))
}
}

0 comments on commit 9352055

Please sign in to comment.