-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add feature isSingleSegmentedSequence
- if enabled the returned value of the insertions can be in the format ins_<position>:<insertion> - if not enabled the returned value is in the format ins_<segment>:<position>:<insertion>
- Loading branch information
1 parent
bb3358e
commit a90e331
Showing
10 changed files
with
97 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
lapis2/src/main/kotlin/org/genspectrum/lapis/config/SingleSegmentedSequenceFeature.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.genspectrum.lapis.config | ||
|
||
import org.springframework.stereotype.Component | ||
|
||
const val IS_SEQUENCE_SINGLE_SEGMENTED_FEATURE = "isSingleSegmentedSequence" | ||
|
||
@Component | ||
class SingleSegmentedSequenceFeature(private val databaseConfig: DatabaseConfig) { | ||
fun isEnabled() = | ||
databaseConfig.schema.features.any { it.name == IS_SEQUENCE_SINGLE_SEGMENTED_FEATURE } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
lapis2/src/test/kotlin/org/genspectrum/lapis/config/SingleSegmentedSequenceFeatureTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.genspectrum.lapis.config | ||
|
||
import org.junit.jupiter.api.Assertions.assertFalse | ||
import org.junit.jupiter.api.Assertions.assertTrue | ||
import org.junit.jupiter.api.Test | ||
|
||
class SingleSegmentedSequenceFeatureTest { | ||
@Test | ||
fun `given a databaseConfig with a feature named isSingleSegmentedSequence then isEnabled returns true`() { | ||
val input = databaseConfigWithFeatures(listOf(DatabaseFeature(IS_SEQUENCE_SINGLE_SEGMENTED_FEATURE))) | ||
|
||
val underTest = SingleSegmentedSequenceFeature(input) | ||
|
||
assertTrue(underTest.isEnabled()) | ||
} | ||
|
||
@Test | ||
fun `given a databaseConfig without a feature named isSingleSegmentedSequence then isEnabled returns false`() { | ||
val input = databaseConfigWithFeatures(listOf(DatabaseFeature("notTheRightFeature"))) | ||
|
||
val underTest = SingleSegmentedSequenceFeature(input) | ||
|
||
assertFalse(underTest.isEnabled()) | ||
} | ||
|
||
private fun databaseConfigWithFeatures( | ||
databaseFeatures: List<DatabaseFeature> = emptyList(), | ||
) = DatabaseConfig( | ||
DatabaseSchema( | ||
"test config", | ||
OpennessLevel.OPEN, | ||
emptyList(), | ||
"test primary key", | ||
databaseFeatures, | ||
), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters