diff --git a/src/test/scala/cromwell/engine/WorkflowManagerActorSpec.scala b/src/test/scala/cromwell/engine/WorkflowManagerActorSpec.scala index ee50fe7bdf6..68d3883ded5 100644 --- a/src/test/scala/cromwell/engine/WorkflowManagerActorSpec.scala +++ b/src/test/scala/cromwell/engine/WorkflowManagerActorSpec.scala @@ -3,18 +3,18 @@ package cromwell.engine import java.util.{Calendar, UUID} import akka.testkit.TestActorRef -import cromwell.binding.FullyQualifiedName import cromwell.binding.types.WdlStringType import cromwell.binding.values.WdlString -import cromwell.engine.ExecutionStatus.{Done, NotStarted, Running} +import cromwell.engine.ExecutionStatus.{NotStarted, Running} import cromwell.engine.db.DataAccess.WorkflowInfo -import cromwell.engine.db.{CallStatus, QueryWorkflowExecutionResult, DummyDataAccess} +import cromwell.engine.db.{DummyDataAccess, QueryWorkflowExecutionResult} import cromwell.engine.workflow.WorkflowManagerActor import cromwell.engine.workflow.WorkflowManagerActor.{SubmitWorkflow, WorkflowOutputs, WorkflowStatus} import cromwell.util.SampleWdl import cromwell.util.SampleWdl.HelloWorld -import cromwell.{engine, CromwellTestkitSpec, binding} +import cromwell.{CromwellTestkitSpec, binding} +import scala.collection.concurrent.TrieMap import scala.concurrent.Future @@ -56,8 +56,12 @@ class WorkflowManagerActorSpec extends CromwellTestkitSpec("WorkflowManagerActor val dataAccess = new DummyDataAccess() { workflows foreach { workflow => val id = workflow.workflowId - executionStatuses += (id -> Map("hello.hello" -> (if (id == submitted.workflowId) NotStarted else Running))) - symbolStore += (workflow.workflowId -> symbols) + val status = if (id == submitted.workflowId) NotStarted else Running + executionStatuses(id) = TrieMap("hello.hello" -> status) + symbolStore(id) = TrieMap.empty + symbols foreach { case(symbolStoreKey, symbolStoreEntry) => + symbolStore(id)(symbolStoreKey) = symbolStoreEntry + } } override def getWorkflowsByState(states: Traversable[WorkflowState]): Future[Traversable[WorkflowInfo]] = { diff --git a/src/test/scala/cromwell/engine/db/DummyDataAccess.scala b/src/test/scala/cromwell/engine/db/DummyDataAccess.scala index df525700d21..fa49e9a21e9 100644 --- a/src/test/scala/cromwell/engine/db/DummyDataAccess.scala +++ b/src/test/scala/cromwell/engine/db/DummyDataAccess.scala @@ -1,21 +1,22 @@ package cromwell.engine.db import cromwell.binding.values.WdlValue -import cromwell.binding.{Call, FullyQualifiedName, WdlNamespace} +import cromwell.binding.{Call, FullyQualifiedName} import cromwell.engine.ExecutionStatus.ExecutionStatus import cromwell.engine._ import cromwell.engine.backend.Backend import cromwell.engine.db.DataAccess.WorkflowInfo +import scala.collection.concurrent.TrieMap import scala.concurrent.Future case class DummyDataAccess() extends DataAccess { - private var workflowStates: Map[WorkflowId, WorkflowState] = Map.empty + private val workflowStates: TrieMap[WorkflowId, WorkflowState] = TrieMap.empty - var executionStatuses: Map[WorkflowId, Map[String, ExecutionStatus]] = Map.empty + val executionStatuses: TrieMap[WorkflowId, TrieMap[String, ExecutionStatus]] = TrieMap.empty - var symbolStore: Map[WorkflowId, Map[SymbolStoreKey, SymbolStoreEntry]] = Map.empty + val symbolStore: TrieMap[WorkflowId, TrieMap[SymbolStoreKey, SymbolStoreEntry]] = TrieMap.empty /** * Creates a row in each of the backend-info specific tables for each call in `calls` corresponding to the backend @@ -25,12 +26,13 @@ case class DummyDataAccess() extends DataAccess { override def createWorkflow(workflowInfo: WorkflowInfo, symbols: Traversable[SymbolStoreEntry], calls: Traversable[Call], backend: Backend): Future[Unit] = { Future.successful { - executionStatuses += (workflowInfo.workflowId -> Map.empty) - setStatus(workflowInfo.workflowId, calls map { _.fullyQualifiedName }, ExecutionStatus.NotStarted) - val newEntries = symbols map { symbol => - symbol.key -> symbol + val id = workflowInfo.workflowId + executionStatuses += (id -> TrieMap.empty) + symbolStore += (id -> TrieMap.empty) + setStatus(id, calls map { _.fullyQualifiedName }, ExecutionStatus.NotStarted) + symbols foreach { symbol => + symbolStore(id)(symbol.key) = symbol } - symbolStore += (workflowInfo.workflowId -> newEntries.toMap) } } @@ -41,7 +43,9 @@ case class DummyDataAccess() extends DataAccess { override def setStatus(workflowId: WorkflowId, callFqns: Traversable[FullyQualifiedName], callStatus: CallStatus): Future[Unit] = { Future.successful { - executionStatuses += (workflowId -> (executionStatuses(workflowId) ++ callFqns.map { _ -> callStatus}.toMap)) + callFqns foreach { callFqn => + executionStatuses(workflowId)(callFqn) = callStatus + } } } @@ -69,17 +73,15 @@ case class DummyDataAccess() extends DataAccess { /** The keys in the Map are locally qualified names. */ override def setOutputs(workflowId: WorkflowId, call: Call, callOutputs: Map[String, WdlValue]): Future[Unit] = { Future.successful { - val newOutputs = for { - callOutput <- callOutputs - entry = SymbolStoreEntry(call.fullyQualifiedName + "." + callOutput._1, callOutput._2, input = false) - } yield entry.key -> entry - - symbolStore += (workflowId -> (symbolStore(workflowId) ++ newOutputs)) + callOutputs foreach { case (name, wdlValue) => + val entry = SymbolStoreEntry(call.fullyQualifiedName + "." + name, wdlValue, input = false) + symbolStore(workflowId)(entry.key) = entry + } } } override def getExecutionStatuses(workflowId: WorkflowId): Future[Map[FullyQualifiedName, CallStatus]] = { - Future.successful(executionStatuses(workflowId)) + Future.successful(executionStatuses(workflowId).toMap) } override def getExecutionBackendInfo(workflowId: WorkflowId, call: Call): Future[CallBackendInfo] = ???