Skip to content

Commit

Permalink
JPERF-273: Add ParallelInstallation
Browse files Browse the repository at this point in the history
  • Loading branch information
dagguh committed Jul 4, 2019
1 parent f41019d commit e665f02
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.atlassian.performance.tools.infrastructure.api.jira.flow.install

import com.atlassian.performance.tools.concurrency.api.submitWithLogContext
import com.atlassian.performance.tools.infrastructure.api.distribution.ProductDistribution
import com.atlassian.performance.tools.infrastructure.api.jira.JiraHomeSource
import com.atlassian.performance.tools.infrastructure.api.jira.flow.JiraNodeFlow
import com.atlassian.performance.tools.infrastructure.api.jira.flow.TcpServer
import com.atlassian.performance.tools.infrastructure.api.jvm.JavaDevelopmentKit
import com.atlassian.performance.tools.ssh.api.SshConnection
import java.util.concurrent.Executors

class ParallelInstallation(
private val jiraHomeSource: JiraHomeSource,
private val productDistribution: ProductDistribution,
private val jdk: JavaDevelopmentKit
) : JiraInstallation {

override fun install(
ssh: SshConnection,
server: TcpServer,
flow: JiraNodeFlow
): InstalledJira {
val pool = Executors.newCachedThreadPool { runnable ->
Thread(runnable, "jira-installation-${runnable.hashCode()}")
}
val product = pool.submitWithLogContext("product") {
productDistribution.install(ssh, ".")
}
val home = pool.submitWithLogContext("home") {
jiraHomeSource.download(ssh)
}
val java = pool.submitWithLogContext("java") {
jdk.also { it.install(ssh) }
}
val jira = InstalledJira(home.get(), product.get(), java.get(), server)
pool.shutdownNow()
return jira
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.atlassian.performance.tools.infrastructure.api.jira.flow.TcpServer
import com.atlassian.performance.tools.infrastructure.api.jvm.JavaDevelopmentKit
import com.atlassian.performance.tools.ssh.api.SshConnection

class DefaultJiraInstallation(
class SequentialInstallation(
private val jiraHomeSource: JiraHomeSource,
private val productDistribution: ProductDistribution,
private val jdk: JavaDevelopmentKit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class HookedJiraStartIT {
val flow = JiraNodeFlow()
flow.hookPostStart(DefaultStartedJiraHook())
flow.hookPostInstall(DefaultPostInstallHook(config))
val jiraInstallation = HookedJiraInstallation(DefaultJiraInstallation(
val jiraInstallation = HookedJiraInstallation(ParallelInstallation(
jiraHomeSource = EmptyJiraHome(),
productDistribution = PublicJiraSoftwareDistribution("7.13.0"),
jdk = OracleJDK()
Expand Down Expand Up @@ -76,7 +76,7 @@ class HookedJiraStartIT {
val sysstat = UbuntuSysstat()
flow.hookPreInstall(sysstat)
flow.hookPreInstall(FailingHook())
val jiraInstallation = HookedJiraInstallation(DefaultJiraInstallation(
val jiraInstallation = HookedJiraInstallation(ParallelInstallation(
jiraHomeSource = EmptyJiraHome(),
productDistribution = PublicJiraSoftwareDistribution("7.13.0"),
jdk = OracleJDK()
Expand Down

0 comments on commit e665f02

Please sign in to comment.