Fix test code package name

This commit is contained in:
Tomofumi Tanaka
2015-03-16 23:38:00 +09:00
parent 825f2518e9
commit 7e92f1abd5
11 changed files with 71 additions and 43 deletions

View File

@@ -21,7 +21,7 @@ object AutoUpdate {
* The history of versions. A head of this sequence is the current BitBucket version. * The history of versions. A head of this sequence is the current BitBucket version.
*/ */
val versions = Seq( val versions = Seq(
// TODO(tanacasino): Add 3.1 migration new Version(3, 1),
new Version(3, 0), new Version(3, 0),
new Version(2, 8), new Version(2, 8),
new Version(2, 7) { new Version(2, 7) {

View File

@@ -1,10 +1,16 @@
package api package gitbucket.core.api
import gitbucket.core.util.RepositoryName
import org.specs2.mutable.Specification import org.specs2.mutable.Specification
import java.util.{Date, Calendar, TimeZone}
import util.RepositoryName
import org.json4s.jackson.JsonMethods.{pretty, parse} import org.json4s.jackson.JsonMethods.{pretty, parse}
import org.json4s._ import org.json4s._
import org.specs2.matcher._ import org.specs2.matcher._
import java.util.{Calendar, TimeZone}
class JsonFormatSpec extends Specification { class JsonFormatSpec extends Specification {
val date1 = { val date1 = {
val d = Calendar.getInstance(TimeZone.getTimeZone("UTC")) val d = Calendar.getInstance(TimeZone.getTimeZone("UTC"))

View File

@@ -1,8 +1,9 @@
package model package gitbucket.core.model
import gitbucket.core.model.CommitState._
import org.specs2.mutable.Specification import org.specs2.mutable.Specification
import CommitState._
class CommitStateSpec extends Specification { class CommitStateSpec extends Specification {
"CommitState" should { "CommitState" should {

View File

@@ -1,8 +1,11 @@
package service package gitbucket.core.service
import gitbucket.core.model._
import org.specs2.mutable.Specification import org.specs2.mutable.Specification
import java.util.Date import java.util.Date
import model._
class AccessTokenServiceSpec extends Specification with ServiceSpecBase { class AccessTokenServiceSpec extends Specification with ServiceSpecBase {
@@ -18,7 +21,7 @@ class AccessTokenServiceSpec extends Specification with ServiceSpecBase {
val tokenHash = AccessTokenService.tokenToHash(token) val tokenHash = AccessTokenService.tokenToHash(token)
AccessTokenService.getAccessTokens("root") must be like{ AccessTokenService.getAccessTokens("root") must be like{
case List(model.AccessToken(`id`, "root", `tokenHash`, "note")) => ok case List(AccessToken(`id`, "root", `tokenHash`, "note")) => ok
} }
}} }}
@@ -29,7 +32,7 @@ class AccessTokenServiceSpec extends Specification with ServiceSpecBase {
AccessTokenService.generateAccessToken("user2", "note2") AccessTokenService.generateAccessToken("user2", "note2")
AccessTokenService.getAccessTokens("root") must be like{ AccessTokenService.getAccessTokens("root") must be like{
case List(model.AccessToken(`id`, "root", `tokenHash`, "note")) => ok case List(AccessToken(`id`, "root", `tokenHash`, "note")) => ok
} }
}} }}
@@ -75,7 +78,7 @@ class AccessTokenServiceSpec extends Specification with ServiceSpecBase {
"when update Account.userName then AccessToken.userName changed" in { withTestDB { implicit session => "when update Account.userName then AccessToken.userName changed" in { withTestDB { implicit session =>
val user2 = generateNewAccount("user2") val user2 = generateNewAccount("user2")
val (id, token) = AccessTokenService.generateAccessToken("user2", "note") val (id, token) = AccessTokenService.generateAccessToken("user2", "note")
import model.Profile._ import gitbucket.core.model.Profile._
import profile.simple._ import profile.simple._
Accounts.filter(_.userName === "user2".bind).map(_.userName).update("user3") Accounts.filter(_.userName === "user2".bind).map(_.userName).update("user3")

View File

@@ -1,9 +1,14 @@
package service package gitbucket.core.service
import org.specs2.mutable.Specification
import java.util.Date import gitbucket.core.model._
import model._ import gitbucket.core.model.Profile._
import model.Profile._
import profile.simple._ import profile.simple._
import org.specs2.mutable.Specification
import java.util.Date
class CommitStatusServiceSpec extends Specification with ServiceSpecBase with CommitStatusService class CommitStatusServiceSpec extends Specification with ServiceSpecBase with CommitStatusService
with RepositoryService with AccountService{ with RepositoryService with AccountService{
val now = new java.util.Date() val now = new java.util.Date()

View File

@@ -1,9 +1,12 @@
package service package gitbucket.core.service
import gitbucket.core.model._
import gitbucket.core.service.IssuesService._
import org.specs2.mutable.Specification import org.specs2.mutable.Specification
import java.util.Date import java.util.Date
import model._
import service.IssuesService._
class IssuesServiceSpec extends Specification with ServiceSpecBase { class IssuesServiceSpec extends Specification with ServiceSpecBase {
"IssuesService" should { "IssuesService" should {

View File

@@ -1,18 +1,22 @@
package service package gitbucket.core.service
import org.specs2.mutable.Specification
import java.util.Date import gitbucket.core.model._
import model._ import gitbucket.core.util.JGitUtil
import util.JGitUtil import gitbucket.core.util.Directory._
import util.Directory._ import gitbucket.core.util.Implicits._
import java.nio.file._ import gitbucket.core.util.ControlUtil._
import util.Implicits._
import util.ControlUtil._ import org.apache.commons.io.FileUtils
import org.eclipse.jgit.api.Git import org.eclipse.jgit.api.Git
import org.eclipse.jgit.dircache.DirCache import org.eclipse.jgit.dircache.DirCache
import org.eclipse.jgit.lib._ import org.eclipse.jgit.lib._
import org.eclipse.jgit.treewalk._
import org.eclipse.jgit.revwalk._ import org.eclipse.jgit.revwalk._
import org.apache.commons.io.FileUtils import org.eclipse.jgit.treewalk._
import org.specs2.mutable.Specification
import java.nio.file._
import java.util.Date
class MergeServiceSpec extends Specification { class MergeServiceSpec extends Specification {
sequential sequential

View File

@@ -1,9 +1,11 @@
package service package gitbucket.core.service
import gitbucket.core.model._
import gitbucket.core.model.Profile._
import org.specs2.mutable.Specification import org.specs2.mutable.Specification
import java.util.Date
import model._
import model.Profile._
import profile.simple._
class RepositoryServiceSpec extends Specification with ServiceSpecBase with RepositoryService with AccountService{ class RepositoryServiceSpec extends Specification with ServiceSpecBase with RepositoryService with AccountService{
"RepositoryService" should { "RepositoryService" should {
"renameRepository can rename CommitState" in { withTestDB { implicit session => "renameRepository can rename CommitState" in { withTestDB { implicit session =>

View File

@@ -2,14 +2,18 @@ package gitbucket.core.service
import gitbucket.core.servlet.AutoUpdate import gitbucket.core.servlet.AutoUpdate
import gitbucket.core.util.{ControlUtil, DatabaseConfig, FileUtil} import gitbucket.core.util.{ControlUtil, DatabaseConfig, FileUtil}
import gitbucket.core.util.ControlUtil._
import gitbucket.core.model._
import gitbucket.core.model.Profile._ import gitbucket.core.model.Profile._
import profile.simple._ import profile.simple._
import ControlUtil._
import java.sql.DriverManager
import org.apache.commons.io.FileUtils import org.apache.commons.io.FileUtils
import scala.util.Random
import java.sql.DriverManager
import java.io.File import java.io.File
import model._
import scala.util.Random
trait ServiceSpecBase { trait ServiceSpecBase {

View File

@@ -1,8 +1,7 @@
package service package gitbucket.core.service
import org.specs2.mutable.Specification import org.specs2.mutable.Specification
import java.util.Date
import model._
class WebHookServiceSpec extends Specification with ServiceSpecBase { class WebHookServiceSpec extends Specification with ServiceSpecBase {
lazy val service = new WebHookPullRequestService with AccountService with RepositoryService with PullRequestService with IssuesService lazy val service = new WebHookPullRequestService with AccountService with RepositoryService with PullRequestService with IssuesService

View File

@@ -1,7 +1,8 @@
package util package gitbucket.core.util
import org.specs2.mutable._ import org.specs2.mutable._
class DirectorySpec extends Specification { class DirectorySpec extends Specification {
"GitBucketHome" should { "GitBucketHome" should {
"set under target in test scope" in { "set under target in test scope" in {