Fixed build issues

This commit is contained in:
Abdelilah El Aissaoui 2023-01-20 11:10:59 +01:00
parent cca90c246d
commit ff337763b4
2 changed files with 6 additions and 4 deletions

View file

@ -13,13 +13,10 @@ import javax.inject.Provider
private const val DEFAULT_SSH_PORT = 22
class GRemoteSession @Inject constructor(
private val processProvider: Provider<GProcess>,
private val processSession: Provider<LibSshSession>,
private val credentialsStateManager: CredentialsStateManager,
) : RemoteSession {
private val client = SshClient.setUpDefaultClient()
private var connectFuture: ConnectFuture? = null
private var session: LibSshSession? = null
override fun exec(commandName: String, timeout: Int): Process {

View file

@ -4,6 +4,7 @@ import com.jetpackduba.gitnuro.credentials.*
import com.jetpackduba.gitnuro.di.factories.HttpCredentialsFactory
import com.jetpackduba.gitnuro.git.remote_operations.CloneRepositoryUseCase
import com.jetpackduba.gitnuro.git.remote_operations.HandleTransportUseCase
import com.jetpackduba.gitnuro.ssh.libssh.LibSshSession
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.runBlocking
@ -13,6 +14,7 @@ import org.junit.jupiter.api.extension.BeforeAllCallback
import org.junit.jupiter.api.extension.ExtensionContext
import org.junit.jupiter.api.extension.ExtensionContext.Namespace.GLOBAL
import java.io.File
import javax.inject.Provider
import kotlin.io.path.createTempDirectory
private const val REPO_URL = "https://github.com/JetpackDuba/Gitnuro_TestsRepo.git"
@ -33,10 +35,13 @@ class BeforeRepoAllTestsExtension : BeforeAllCallback, AfterAllCallback {
context.root.getStore(GLOBAL).put("gitnuro_tests", this)
val credentialsStateManager = CredentialsStateManager()
val ssh = Provider {
LibSshSession()
}
val cloneRepositoryUseCase =
CloneRepositoryUseCase(
HandleTransportUseCase(
sessionManager = GSessionManager { GRemoteSession({ GProcess() }, credentialsStateManager) },
sessionManager = GSessionManager { GRemoteSession(ssh, credentialsStateManager) },
httpCredentialsProvider = object : HttpCredentialsFactory {
override fun create(git: Git?): HttpCredentialsProvider =
HttpCredentialsProvider(credentialsStateManager, git)