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
package org.broadinstitute.toolkit | |
package core.domain.analysis | |
/** | |
* Maintains sequences of singleton column view policies by the policy | |
* type. Also contains the composite column view policy that is used by | |
* default in an analysis. | |
*/ | |
object ColumnViewPolicy { |
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
trait Analysis { | |
val scoreColumns: Seq[ScoreColumn] = Seq() | |
} | |
trait AnalysisColumn | |
trait ScoreColumn extends AnalysisColumn | |
trait RawDataScoreColumn extends ScoreColumn | |
trait ComputedScoreColumn extends ScoreColumn { | |
val parentColumns: Seq[ScoreColumn] = Seq() | |
} |
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
case class User(username: String, password: String) | |
trait UserRepositoryComponent { | |
val userRepository: UserRepository | |
class UserRepository { | |
def create(user: User): Unit = println("create " + user) | |
} | |
} | |
trait UserServiceComponent { |
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
case class User(username: String, password: String) | |
trait UserRepositoryComponent { | |
val userRepository: UserRepository | |
trait UserRepository { | |
def create(user: User): Unit | |
} | |
} | |
trait UserRepositoryComponentImpl extends UserRepositoryComponent { |
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
// libraryDependencies += "org.scalatest" %% "scalatest" % "1.9.1" % "test" | |
// | |
// libraryDependencies += "org.easymock" % "easymockclassextension" % "3.1" % "test" | |
import org.scalatest.mock.EasyMockSugar | |
trait ComponentRegistryMock extends ComponentRegistry with EasyMockSugar { | |
val userService = mock[UserService] | |
val userRepository = mock[UserRepository] | |
} |
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
import org.easymock.EasyMock.reset | |
import org.scalatest.FlatSpec | |
class UserServiceSpec | |
extends FlatSpec | |
with ComponentRegistryMock | |
with UserServiceComponentImpl { | |
behavior of "UserServiceImpl.create" |
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
trait RepositoryComponent | |
extends ProjectRepositoryComponent | |
with UserRepositoryComponent | |
trait RepositoryComponentImpl | |
extends RepositoryComponent | |
with ProjectRepositoryComponentImpl | |
with UserRepositoryComponentImpl | |
trait ServiceComponent |
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
trait ProjectRepositoryComponent { | |
val projectRepository: ProjectRepository | |
trait ProjectRepository { | |
def create(project: Project): Unit | |
} | |
} | |
trait ProjectRepositoryComponentImpl extends ProjectRepositoryComponent { | |
self: UserServiceComponent => // <= does not compile! | |
override val projectRepository: ProjectRepository = new ProjectRepositoryImpl |
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
trait RepositoryComponentImpl | |
extends RepositoryComponent | |
with ProjectRepositoryComponentImpl | |
with UserRepositoryComponentImpl { | |
self: ServiceComponent => | |
} |
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
trait RepositoryComponentImpl | |
extends RepositoryComponent | |
with ProjectRepositoryComponentImpl | |
with UserRepositoryComponentImpl { | |
// do not self-type to ServiceComponent here as it breaks design constraint! | |
} |
OlderNewer