Skip to content

Commit

Permalink
Cleanup test classes
Browse files Browse the repository at this point in the history
  • Loading branch information
dzikoysk committed Jul 11, 2023
1 parent 8e364c1 commit 2394fa8
Show file tree
Hide file tree
Showing 23 changed files with 62 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.reposilite.specification
package com.reposilite

import com.reposilite.storage.filesystem.FileSystemStorageProviderSettings
import org.junit.jupiter.api.extension.BeforeEachCallback
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.reposilite.specification
package com.reposilite

import com.reposilite.storage.filesystem.FileSystemStorageProviderSettings
import org.junit.jupiter.api.extension.AfterEachCallback
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.reposilite.specification
package com.reposilite

import com.reposilite.storage.filesystem.FileSystemStorageProviderSettings
import org.junit.jupiter.api.extension.BeforeEachCallback
Expand All @@ -26,7 +26,7 @@ import org.junit.jupiter.api.extension.ExtensionContext
* - SQLite
* - Local file system
*/
internal class LocalSpecificationJunitExtension : Extension, BeforeEachCallback {
internal class RecommendedLocalSpecificationJunitExtension : Extension, BeforeEachCallback {

override fun beforeEach(context: ExtensionContext?) {
context?.also {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.reposilite.specification
package com.reposilite

import com.reposilite.storage.s3.S3StorageProviderSettings
import org.junit.jupiter.api.extension.AfterEachCallback
Expand All @@ -34,7 +34,7 @@ import org.testcontainers.utility.DockerImageName
* - AWS S3 through LocalStack
*/
@Testcontainers
internal class RemoteSpecificationJunitExtension : Extension, BeforeEachCallback, AfterEachCallback {
internal class RecommendedRemoteSpecificationJunitExtension : Extension, BeforeEachCallback, AfterEachCallback {

private class SpecifiedMariaDBContainer(image: String) : MariaDBContainer<SpecifiedMariaDBContainer>(DockerImageName.parse(image))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@
* limitations under the License.
*/

package com.reposilite.specification
package com.reposilite

import com.reposilite.Reposilite
import com.reposilite.ReposiliteFactory
import com.reposilite.ReposiliteParameters
import com.reposilite.configuration.local.LocalConfiguration
import com.reposilite.configuration.local.infrastructure.LOCAL_CONFIGURATION_FILE
import com.reposilite.configuration.shared.SharedConfigurationFacade
Expand All @@ -38,15 +35,13 @@ import org.junit.jupiter.api.io.TempDir
import panda.std.Result
import panda.std.reactive.ReferenceUtils
import java.io.File
import java.io.PrintStream
import java.nio.file.Files
import java.util.concurrent.ThreadLocalRandom

/**
* This is a dirty launcher of Reposilite instance for integration tests.
* Every integration test is launched twice, with local and remote integrations, through dedicated extensions:
* - [LocalSpecificationJunitExtension]
* - [RemoteSpecificationJunitExtension]
* - [RecommendedLocalSpecificationJunitExtension]
* - [RecommendedRemoteSpecificationJunitExtension]
*/
@Suppress("PropertyName")
internal abstract class ReposiliteRunner {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
* limitations under the License.
*/

package com.reposilite.specification
package com.reposilite

import com.reposilite.ReposiliteObjectMapper
import com.reposilite.maven.MavenFacade
import com.reposilite.maven.api.DeployRequest
import com.reposilite.maven.api.Metadata
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import com.reposilite.configuration.specification.SettingsIntegrationSpecificati
import com.reposilite.frontend.application.FrontendSettings
import com.reposilite.maven.application.MavenSettings
import com.reposilite.shared.ErrorResponse
import com.reposilite.specification.LocalSpecificationJunitExtension
import com.reposilite.specification.RemoteSpecificationJunitExtension
import com.reposilite.RecommendedLocalSpecificationJunitExtension
import com.reposilite.RecommendedRemoteSpecificationJunitExtension
import com.reposilite.statistics.api.ResolvedRequestsInterval.YEARLY
import com.reposilite.statistics.application.StatisticsSettings
import com.reposilite.web.application.WebSettings
Expand All @@ -38,10 +38,10 @@ import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith

@ExtendWith(LocalSpecificationJunitExtension::class)
@ExtendWith(RecommendedLocalSpecificationJunitExtension::class)
internal class LocalSettingsIntegrationTest : SettingsIntegrationTest()

@ExtendWith(RemoteSpecificationJunitExtension::class)
@ExtendWith(RecommendedRemoteSpecificationJunitExtension::class)
internal class RemoteSettingsIntegrationTest : SettingsIntegrationTest()

internal abstract class SettingsIntegrationTest : SettingsIntegrationSpecification() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,20 @@

@file:Suppress("FunctionName")

package com.reposilite
package com.reposilite.configuration

import com.reposilite.ReposiliteParameters
import com.reposilite.configuration.shared.SharedConfigurationFacade
import com.reposilite.frontend.application.FrontendSettings
import com.reposilite.specification.LocalSpecificationJunitExtension
import com.reposilite.specification.ReposiliteSpecification
import com.reposilite.RecommendedLocalSpecificationJunitExtension
import com.reposilite.ReposiliteSpecification
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith
import java.nio.file.Files

@ExtendWith(LocalSpecificationJunitExtension::class)
internal class ReposiliteParametersIntegrationTest : ReposiliteSpecification() {
@ExtendWith(RecommendedLocalSpecificationJunitExtension::class)
internal class StartupParametersIntegrationTest : ReposiliteSpecification() {

override fun overrideParameters(parameters: ReposiliteParameters) {
// given: a custom shared configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@

package com.reposilite.configuration.specification

import com.reposilite.specification.ReposiliteSpecification
import com.reposilite.ReposiliteSpecification

internal abstract class SettingsIntegrationSpecification : ReposiliteSpecification()
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
package com.reposilite.javadocs

import com.reposilite.javadocs.specification.JavadocsIntegrationSpecification
import com.reposilite.specification.LocalSpecificationJunitExtension
import com.reposilite.specification.RemoteSpecificationJunitExtension
import com.reposilite.RecommendedLocalSpecificationJunitExtension
import com.reposilite.RecommendedRemoteSpecificationJunitExtension
import com.reposilite.storage.api.Location
import kong.unirest.Unirest.*
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith

@ExtendWith(LocalSpecificationJunitExtension::class)
@ExtendWith(RecommendedLocalSpecificationJunitExtension::class)
internal class LocalJavadocsIntegrationTest : JavadocsIntegrationTest()

@ExtendWith(RemoteSpecificationJunitExtension::class)
@ExtendWith(RecommendedRemoteSpecificationJunitExtension::class)
internal class RemoteJavadocsIntegrationTest : JavadocsIntegrationTest()

internal abstract class JavadocsIntegrationTest : JavadocsIntegrationSpecification() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package com.reposilite.javadocs.specification

import com.reposilite.specification.ReposiliteSpecification
import com.reposilite.ReposiliteSpecification

internal abstract class JavadocsIntegrationSpecification : ReposiliteSpecification()
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
package com.reposilite.maven

import com.reposilite.maven.specification.MavenIntegrationSpecification
import com.reposilite.specification.LocalSpecificationJunitExtension
import com.reposilite.specification.RemoteSpecificationJunitExtension
import com.reposilite.RecommendedLocalSpecificationJunitExtension
import com.reposilite.RecommendedRemoteSpecificationJunitExtension
import com.reposilite.token.RoutePermission.READ
import io.javalin.http.HttpStatus.UNAUTHORIZED
import kong.unirest.Unirest.get
Expand All @@ -30,10 +30,10 @@ import org.junit.jupiter.api.extension.ExtendWith
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.ValueSource

@ExtendWith(LocalSpecificationJunitExtension::class)
@ExtendWith(RecommendedLocalSpecificationJunitExtension::class)
internal class LocalMavenApiIntegrationTest : MavenApiIntegrationTest()

@ExtendWith(RemoteSpecificationJunitExtension::class)
@ExtendWith(RecommendedRemoteSpecificationJunitExtension::class)
internal class RemoteMavenApiIntegrationTest : MavenApiIntegrationTest()

internal abstract class MavenApiIntegrationTest : MavenIntegrationSpecification() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@
package com.reposilite.maven

import com.reposilite.configuration.local.LocalConfiguration
import com.reposilite.configuration.shared.SharedConfigurationFacade
import com.reposilite.maven.application.MavenSettings
import com.reposilite.maven.specification.MavenIntegrationSpecification
import com.reposilite.shared.ErrorResponse
import com.reposilite.specification.LocalSpecificationJunitExtension
import com.reposilite.specification.RemoteSpecificationJunitExtension
import com.reposilite.RecommendedLocalSpecificationJunitExtension
import com.reposilite.RecommendedRemoteSpecificationJunitExtension
import com.reposilite.storage.api.DocumentInfo
import io.javalin.http.HttpStatus.NOT_FOUND
import io.javalin.http.HttpStatus.UNAUTHORIZED
Expand All @@ -40,10 +38,10 @@ import org.junit.jupiter.api.extension.ExtendWith
import java.util.concurrent.CompletableFuture
import java.util.concurrent.CountDownLatch

@ExtendWith(LocalSpecificationJunitExtension::class)
@ExtendWith(RecommendedLocalSpecificationJunitExtension::class)
internal class LocalMavenIntegrationTest : MavenIntegrationTest()

@ExtendWith(RemoteSpecificationJunitExtension::class)
@ExtendWith(RecommendedRemoteSpecificationJunitExtension::class)
internal class RemoteMavenIntegrationTest : MavenIntegrationTest()

internal abstract class MavenIntegrationTest : MavenIntegrationSpecification() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.reposilite.maven.specification

import com.reposilite.specification.ReposiliteSpecification
import com.reposilite.ReposiliteSpecification
import io.javalin.Javalin
import kotlinx.coroutines.Job

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
package com.reposilite.statistics

import com.reposilite.maven.api.Identifier
import com.reposilite.specification.ExperimentalLocalSpecificationJunitExtension
import com.reposilite.specification.ExperimentalRemoteSpecficiationJunitExtension
import com.reposilite.specification.LocalSpecificationJunitExtension
import com.reposilite.specification.RemoteSpecificationJunitExtension
import com.reposilite.ExperimentalLocalSpecificationJunitExtension
import com.reposilite.ExperimentalRemoteSpecficiationJunitExtension
import com.reposilite.RecommendedLocalSpecificationJunitExtension
import com.reposilite.RecommendedRemoteSpecificationJunitExtension
import com.reposilite.statistics.api.AllResolvedResponse
import com.reposilite.statistics.api.IntervalRecord
import com.reposilite.statistics.api.RepositoryStatistics
Expand All @@ -44,13 +44,13 @@ import java.time.temporal.ChronoUnit
@ExtendWith(ExperimentalRemoteSpecficiationJunitExtension::class)
internal class ExperimentalRemoteStatisticsIntegrationTest : StatisticsIntegrationTest()

@ExtendWith(RemoteSpecificationJunitExtension::class)
@ExtendWith(RecommendedRemoteSpecificationJunitExtension::class)
internal class RemoteStatisticsIntegrationTest : StatisticsIntegrationTest()

@ExtendWith(ExperimentalLocalSpecificationJunitExtension::class)
internal class ExperimentalLocalStatisticsIntegrationTest : StatisticsIntegrationTest()

@ExtendWith(LocalSpecificationJunitExtension::class)
@ExtendWith(RecommendedLocalSpecificationJunitExtension::class)
internal class LocalStatisticsIntegrationTest : StatisticsIntegrationTest()

internal abstract class StatisticsIntegrationTest : StatisticsIntegrationSpecification() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.reposilite.statistics.specification

import com.reposilite.specification.ReposiliteSpecification
import com.reposilite.ReposiliteSpecification
import com.reposilite.maven.api.Identifier
import com.reposilite.statistics.StatisticsFacade
import io.javalin.http.HttpStatus.OK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
package com.reposilite.status

import com.reposilite.VERSION
import com.reposilite.specification.ExperimentalLocalSpecificationJunitExtension
import com.reposilite.specification.ExperimentalRemoteSpecficiationJunitExtension
import com.reposilite.specification.LocalSpecificationJunitExtension
import com.reposilite.specification.RemoteSpecificationJunitExtension
import com.reposilite.ExperimentalLocalSpecificationJunitExtension
import com.reposilite.ExperimentalRemoteSpecficiationJunitExtension
import com.reposilite.RecommendedLocalSpecificationJunitExtension
import com.reposilite.RecommendedRemoteSpecificationJunitExtension
import com.reposilite.status.api.InstanceStatusResponse
import com.reposilite.status.api.StatusSnapshot
import com.reposilite.status.specification.StatusIntegrationSpecification
Expand All @@ -37,13 +37,13 @@ import org.junit.jupiter.api.extension.ExtendWith
@ExtendWith(ExperimentalRemoteSpecficiationJunitExtension::class)
internal class ExperimentalRemoteStatusIntegrationTest : StatusIntegrationTest()

@ExtendWith(RemoteSpecificationJunitExtension::class)
@ExtendWith(RecommendedRemoteSpecificationJunitExtension::class)
internal class RemoteStatusIntegrationTest : StatusIntegrationTest()

@ExtendWith(ExperimentalLocalSpecificationJunitExtension::class)
internal class ExperimentalLocalStatusIntegrationTest : StatusIntegrationTest()

@ExtendWith(LocalSpecificationJunitExtension::class)
@ExtendWith(RecommendedLocalSpecificationJunitExtension::class)
internal class LocalStatusIntegrationTest : StatusIntegrationTest()

internal abstract class StatusIntegrationTest : StatusIntegrationSpecification() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.reposilite.status.specification

import com.reposilite.specification.ReposiliteSpecification
import com.reposilite.ReposiliteSpecification

internal abstract class StatusIntegrationSpecification : ReposiliteSpecification() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

package com.reposilite.token

import com.reposilite.specification.LocalSpecificationJunitExtension
import com.reposilite.RecommendedLocalSpecificationJunitExtension
import com.reposilite.console.CommandStatus.SUCCEEDED
import com.reposilite.console.ConsoleFacade
import com.reposilite.token.AccessTokenPermission.MANAGER
Expand All @@ -29,7 +29,7 @@ import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith
import panda.std.ResultAssertions.assertOk

@ExtendWith(LocalSpecificationJunitExtension::class)
@ExtendWith(RecommendedLocalSpecificationJunitExtension::class)
internal class LocalAccessTokenCommandsIntegrationTest : AccessTokenCommandsIntegrationTest()

internal abstract class AccessTokenCommandsIntegrationTest : AccessTokenIntegrationSpecification() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
package com.reposilite.token

import com.reposilite.shared.ErrorResponse
import com.reposilite.specification.LocalSpecificationJunitExtension
import com.reposilite.specification.RemoteSpecificationJunitExtension
import com.reposilite.RecommendedLocalSpecificationJunitExtension
import com.reposilite.RecommendedRemoteSpecificationJunitExtension
import com.reposilite.token.AccessTokenPermission.MANAGER
import com.reposilite.token.AccessTokenType.PERSISTENT
import com.reposilite.token.api.AccessTokenDto
Expand All @@ -36,10 +36,10 @@ import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith

@ExtendWith(LocalSpecificationJunitExtension::class)
@ExtendWith(RecommendedLocalSpecificationJunitExtension::class)
internal class LocalAccessTokenIntegrationTest : AccessTokenIntegrationTest()

@ExtendWith(RemoteSpecificationJunitExtension::class)
@ExtendWith(RecommendedRemoteSpecificationJunitExtension::class)
internal class RemoteAccessTokenIntegrationTest : AccessTokenIntegrationTest()

internal abstract class AccessTokenIntegrationTest : AccessTokenIntegrationSpecification() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.reposilite.token.specification

import com.reposilite.specification.ReposiliteSpecification
import com.reposilite.ReposiliteSpecification
import com.reposilite.auth.AuthenticationFacade
import com.reposilite.auth.api.SessionDetails
import com.reposilite.token.AccessTokenFacade
Expand Down
Loading

0 comments on commit 2394fa8

Please sign in to comment.