-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pivotal ID # 184364448: Previos version file check taking longer than…
… expected (#678) https://www.pivotaltracker.com/story/show/184364448 - updated api to avoid re query submission on each call
- Loading branch information
Showing
17 changed files
with
164 additions
and
64 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
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
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
64 changes: 64 additions & 0 deletions
64
.../kotlin/ac/uk/ebi/biostd/persistence/doc/db/repositories/FileListDocFileRepositoryTest.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,64 @@ | ||
package ac.uk.ebi.biostd.persistence.doc.db.repositories | ||
|
||
import ac.uk.ebi.biostd.persistence.doc.db.data.FileListDocFileDocDataRepository | ||
import ac.uk.ebi.biostd.persistence.doc.integration.MongoDbReposConfig | ||
import ac.uk.ebi.biostd.persistence.doc.model.FileListDocFile | ||
import ac.uk.ebi.biostd.persistence.doc.model.FireDocFile | ||
import ebi.ac.uk.db.MINIMUM_RUNNING_TIME | ||
import ebi.ac.uk.db.MONGO_VERSION | ||
import ebi.ac.uk.extended.model.ExtFileType | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.bson.types.ObjectId | ||
import org.junit.jupiter.api.Test | ||
import org.junit.jupiter.api.extension.ExtendWith | ||
import org.springframework.beans.factory.annotation.Autowired | ||
import org.springframework.boot.test.context.SpringBootTest | ||
import org.springframework.test.context.DynamicPropertyRegistry | ||
import org.springframework.test.context.DynamicPropertySource | ||
import org.springframework.test.context.junit.jupiter.SpringExtension | ||
import org.testcontainers.containers.MongoDBContainer | ||
import org.testcontainers.containers.startupcheck.MinimumDurationRunningStartupCheckStrategy | ||
import org.testcontainers.junit.jupiter.Container | ||
import org.testcontainers.junit.jupiter.Testcontainers | ||
import org.testcontainers.utility.DockerImageName | ||
import java.time.Duration | ||
|
||
@ExtendWith(SpringExtension::class) | ||
@Testcontainers | ||
@SpringBootTest(classes = [MongoDbReposConfig::class]) | ||
class FileListDocFileRepositoryTest( | ||
@Autowired private val repository: FileListDocFileDocDataRepository, | ||
) { | ||
|
||
@Test | ||
fun findBySubmissionAccNoAndSubmissionVersionAndFilePath() { | ||
val file = FireDocFile("filename", "filePath", "relPath", "fireId", listOf(), "md5", 1L, ExtFileType.FILE.value) | ||
val fileListFile = FileListDocFile( | ||
id = ObjectId(), | ||
submissionId = ObjectId(), | ||
file = file, | ||
fileListName = "file-list", | ||
index = 0, | ||
submissionVersion = 1, | ||
submissionAccNo = "S-TEST123" | ||
) | ||
repository.save(fileListFile) | ||
|
||
val result = repository.findBySubmissionAccNoAndSubmissionVersionAndFilePath("S-TEST123", 1, "filePath") | ||
|
||
assertThat(result).containsExactly(fileListFile) | ||
} | ||
|
||
companion object { | ||
@Container | ||
val mongoContainer: MongoDBContainer = MongoDBContainer(DockerImageName.parse(MONGO_VERSION)) | ||
.withStartupCheckStrategy(MinimumDurationRunningStartupCheckStrategy(Duration.ofSeconds(MINIMUM_RUNNING_TIME))) | ||
|
||
@JvmStatic | ||
@DynamicPropertySource | ||
fun propertySource(register: DynamicPropertyRegistry) { | ||
register.add("spring.data.mongodb.uri") { mongoContainer.getReplicaSetUrl("biostudies-test") } | ||
register.add("spring.data.mongodb.database") { "biostudies-test" } | ||
} | ||
} | ||
} |
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
Oops, something went wrong.