Bump Scalatra to 2.7.0-GA (#2494)

This commit is contained in:
Naoki Takezoe
2020-07-27 07:22:19 +09:00
committed by GitHub
parent 9ff4507fe2
commit 6224ec2a7b
28 changed files with 69 additions and 70 deletions

View File

@@ -4,7 +4,7 @@ import com.typesafe.sbt.pgp.PgpKeys._
val Organization = "io.github.gitbucket" val Organization = "io.github.gitbucket"
val Name = "gitbucket" val Name = "gitbucket"
val GitBucketVersion = "4.34.0" val GitBucketVersion = "4.34.0"
val ScalatraVersion = "2.7.0-RC1" val ScalatraVersion = "2.7.0"
val JettyVersion = "9.4.30.v20200611" val JettyVersion = "9.4.30.v20200611"
val JgitVersion = "5.8.0.202006091008-r" val JgitVersion = "5.8.0.202006091008-r"

View File

@@ -7,11 +7,12 @@ import io.github.gitbucket.solidbase.Solidbase
import io.github.gitbucket.solidbase.model.Module import io.github.gitbucket.solidbase.model.Module
import liquibase.database.core.{H2Database, MySQLDatabase, PostgresDatabase} import liquibase.database.core.{H2Database, MySQLDatabase, PostgresDatabase}
import org.junit.runner.Description import org.junit.runner.Description
import org.scalatest.{FunSuite, Tag} import org.scalatest.funsuite.AnyFunSuite
import org.scalatest.Tag
object ExternalDBTest extends Tag("ExternalDBTest") object ExternalDBTest extends Tag("ExternalDBTest")
class GitBucketCoreModuleSpec extends FunSuite { class GitBucketCoreModuleSpec extends AnyFunSuite {
test("Migration H2") { test("Migration H2") {
new Solidbase().migrate( new Solidbase().migrate(

View File

@@ -1,8 +1,8 @@
package gitbucket.core.api package gitbucket.core.api
import org.scalatest.FunSuite import org.scalatest.funsuite.AnyFunSuite
class JsonFormatSpec extends FunSuite { class JsonFormatSpec extends AnyFunSuite {
import ApiSpecModels._ import ApiSpecModels._
private def expected(json: String) = json.replaceAll("\n", "") private def expected(json: String) = json.replaceAll("\n", "")

View File

@@ -1,9 +1,9 @@
package gitbucket.core.model package gitbucket.core.model
import gitbucket.core.model.CommitState._ import gitbucket.core.model.CommitState._
import org.scalatest.FunSpec import org.scalatest.funspec.AnyFunSpec
class CommitStateSpec extends FunSpec { class CommitStateSpec extends AnyFunSpec {
describe("CommitState") { describe("CommitState") {
it("should combine empty must eq PENDING") { it("should combine empty must eq PENDING") {
assert(combine(Set()) == PENDING) assert(combine(Set()) == PENDING)

View File

@@ -1,11 +1,11 @@
package gitbucket.core.service package gitbucket.core.service
import gitbucket.core.model._ import gitbucket.core.model._
import org.scalatest.FunSuite import org.scalatest.funsuite.AnyFunSuite
import gitbucket.core.model.Profile._ import gitbucket.core.model.Profile._
import gitbucket.core.model.Profile.profile.blockingApi._ import gitbucket.core.model.Profile.profile.blockingApi._
class AccessTokenServiceSpec extends FunSuite with ServiceSpecBase { class AccessTokenServiceSpec extends AnyFunSuite with ServiceSpecBase {
test("generateAccessToken") { test("generateAccessToken") {
withTestDB { implicit session => withTestDB { implicit session =>

View File

@@ -1,8 +1,8 @@
package gitbucket.core.service package gitbucket.core.service
import org.scalatest.FunSpec import org.scalatest.funspec.AnyFunSpec
class AccountFederationServiceSpec extends FunSpec with ServiceSpecBase { class AccountFederationServiceSpec extends AnyFunSpec with ServiceSpecBase {
describe("getOrCreateFederatedUser") { describe("getOrCreateFederatedUser") {
it("should create a federated account if it does not exist") { it("should create a federated account if it does not exist") {

View File

@@ -2,9 +2,9 @@ package gitbucket.core.service
import gitbucket.core.model.{Account, GroupMember} import gitbucket.core.model.{Account, GroupMember}
import java.util.Date import java.util.Date
import org.scalatest.FunSuite import org.scalatest.funsuite.AnyFunSuite
class AccountServiceSpec extends FunSuite with ServiceSpecBase { class AccountServiceSpec extends AnyFunSuite with ServiceSpecBase {
val RootMailAddress = "root@localhost" val RootMailAddress = "root@localhost"

View File

@@ -4,10 +4,10 @@ import gitbucket.core.model._
import gitbucket.core.model.Profile._ import gitbucket.core.model.Profile._
import gitbucket.core.model.Profile.profile._ import gitbucket.core.model.Profile.profile._
import gitbucket.core.model.Profile.profile.blockingApi._ import gitbucket.core.model.Profile.profile.blockingApi._
import org.scalatest.FunSuite import org.scalatest.funsuite.AnyFunSuite
class CommitStatusServiceSpec class CommitStatusServiceSpec
extends FunSuite extends AnyFunSuite
with ServiceSpecBase with ServiceSpecBase
with CommitStatusService with CommitStatusService
with RepositoryService with RepositoryService

View File

@@ -2,9 +2,9 @@ package gitbucket.core.service
import gitbucket.core.model._ import gitbucket.core.model._
import gitbucket.core.service.IssuesService._ import gitbucket.core.service.IssuesService._
import org.scalatest.FunSuite import org.scalatest.funsuite.AnyFunSuite
class IssuesServiceSpec extends FunSuite with ServiceSpecBase { class IssuesServiceSpec extends AnyFunSuite with ServiceSpecBase {
test("getCommitStatues") { test("getCommitStatues") {
withTestDB { implicit session => withTestDB { implicit session =>
val user1 = generateNewUserWithDBRepository("user1", "repo1") val user1 = generateNewUserWithDBRepository("user1", "repo1")

View File

@@ -1,9 +1,9 @@
package gitbucket.core.service package gitbucket.core.service
import gitbucket.core.model._ import gitbucket.core.model._
import org.scalatest.FunSpec import org.scalatest.funspec.AnyFunSpec
class LabelsServiceSpec extends FunSpec with ServiceSpecBase { class LabelsServiceSpec extends AnyFunSpec with ServiceSpecBase {
describe("getLabels") { describe("getLabels") {
it("should be empty when not have any labels") { it("should be empty when not have any labels") {
withTestDB { implicit session => withTestDB { implicit session =>

View File

@@ -6,12 +6,12 @@ import gitbucket.core.util.GitSpecUtil._
import org.eclipse.jgit.api.Git import org.eclipse.jgit.api.Git
import org.eclipse.jgit.lib._ import org.eclipse.jgit.lib._
import org.eclipse.jgit.revwalk._ import org.eclipse.jgit.revwalk._
import org.scalatest.FunSpec import org.scalatest.funspec.AnyFunSpec
import java.io.File import java.io.File
import scala.util.Using import scala.util.Using
class MergeServiceSpec extends FunSpec { class MergeServiceSpec extends AnyFunSpec {
val service = new MergeService with AccountService with ActivityService with IssuesService with LabelsService val service = new MergeService with AccountService with ActivityService with IssuesService with LabelsService
with MilestonesService with RepositoryService with PrioritiesService with PullRequestService with CommitsService with MilestonesService with RepositoryService with PrioritiesService with PullRequestService with CommitsService
with WebHookPullRequestService with WebHookPullRequestReviewCommentService with RequestCache {} with WebHookPullRequestService with WebHookPullRequestReviewCommentService with RequestCache {}

View File

@@ -5,10 +5,10 @@ import org.eclipse.jgit.transport.{ReceivePack, ReceiveCommand}
import org.eclipse.jgit.lib.ObjectId import org.eclipse.jgit.lib.ObjectId
import gitbucket.core.model.CommitState import gitbucket.core.model.CommitState
import gitbucket.core.service.ProtectedBranchService.{ProtectedBranchReceiveHook, ProtectedBranchInfo} import gitbucket.core.service.ProtectedBranchService.{ProtectedBranchReceiveHook, ProtectedBranchInfo}
import org.scalatest.FunSpec import org.scalatest.funspec.AnyFunSpec
class ProtectedBranchServiceSpec class ProtectedBranchServiceSpec
extends FunSpec extends AnyFunSpec
with ServiceSpecBase with ServiceSpecBase
with ProtectedBranchService with ProtectedBranchService
with CommitStatusService { with CommitStatusService {

View File

@@ -1,10 +1,10 @@
package gitbucket.core.service package gitbucket.core.service
import gitbucket.core.model._ import gitbucket.core.model._
import org.scalatest.FunSpec import org.scalatest.funspec.AnyFunSpec
class PullRequestServiceSpec class PullRequestServiceSpec
extends FunSpec extends AnyFunSpec
with ServiceSpecBase with ServiceSpecBase
with MergeService with MergeService
with PullRequestService with PullRequestService

View File

@@ -1,9 +1,9 @@
package gitbucket.core.service package gitbucket.core.service
import gitbucket.core.model._ import gitbucket.core.model._
import org.scalatest.FunSuite import org.scalatest.funsuite.AnyFunSuite
class RepositoryServiceSpec extends FunSuite with ServiceSpecBase with RepositoryService with AccountService { class RepositoryServiceSpec extends AnyFunSuite with ServiceSpecBase with RepositoryService with AccountService {
test("renameRepository can rename CommitState, ProtectedBranches") { test("renameRepository can rename CommitState, ProtectedBranches") {
withTestDB { implicit session => withTestDB { implicit session =>
val tester = generateNewAccount("tester") val tester = generateNewAccount("tester")

View File

@@ -14,16 +14,15 @@ import java.io.File
import gitbucket.core.controller.Context import gitbucket.core.controller.Context
import gitbucket.core.service.SystemSettingsService.{RepositoryOperation, Ssh, SystemSettings} import gitbucket.core.service.SystemSettingsService.{RepositoryOperation, Ssh, SystemSettings}
import javax.servlet.http.{HttpServletRequest, HttpSession} import javax.servlet.http.{HttpServletRequest, HttpSession}
import org.scalatestplus.mockito.MockitoSugar
import org.mockito.Mockito._ import org.mockito.Mockito._
import scala.util.Random import scala.util.Random
import scala.util.Using import scala.util.Using
trait ServiceSpecBase extends MockitoSugar { trait ServiceSpecBase {
val request = mock[HttpServletRequest] val request = mock(classOf[HttpServletRequest])
val session = mock[HttpSession] val session = mock(classOf[HttpSession])
when(request.getRequestURL).thenReturn(new StringBuffer("http://localhost:8080/path.html")) when(request.getRequestURL).thenReturn(new StringBuffer("http://localhost:8080/path.html"))
when(request.getRequestURI).thenReturn("/path.html") when(request.getRequestURI).thenReturn("/path.html")
when(request.getContextPath).thenReturn("") when(request.getContextPath).thenReturn("")

View File

@@ -2,9 +2,10 @@ package gitbucket.core.service
import gitbucket.core.api.JsonFormat import gitbucket.core.api.JsonFormat
import gitbucket.core.service.WebHookService._ import gitbucket.core.service.WebHookService._
import org.scalatest.{Assertion, FunSuite} import org.scalatest.Assertion
import org.scalatest.funsuite.AnyFunSuite
class WebHookJsonFormatSpec extends FunSuite { class WebHookJsonFormatSpec extends AnyFunSuite {
import gitbucket.core.api.ApiSpecModels._ import gitbucket.core.api.ApiSpecModels._
private def assert(payload: WebHookPayload, expected: String): Assertion = { private def assert(payload: WebHookPayload, expected: String): Assertion = {

View File

@@ -1,10 +1,10 @@
package gitbucket.core.service package gitbucket.core.service
import gitbucket.core.model.{WebHook, RepositoryWebHook} import gitbucket.core.model.{WebHook, RepositoryWebHook}
import org.scalatest.FunSuite import org.scalatest.funsuite.AnyFunSuite
import gitbucket.core.model.WebHookContentType import gitbucket.core.model.WebHookContentType
class WebHookServiceSpec extends FunSuite with ServiceSpecBase { class WebHookServiceSpec extends AnyFunSuite with ServiceSpecBase {
lazy val service = new WebHookPullRequestService with AccountService with ActivityService with RepositoryService lazy val service = new WebHookPullRequestService with AccountService with ActivityService with RepositoryService
with MergeService with PullRequestService with IssuesService with CommitsService with LabelsService with MergeService with PullRequestService with IssuesService with CommitsService with LabelsService
with MilestonesService with PrioritiesService with WebHookPullRequestReviewCommentService with RequestCache with MilestonesService with PrioritiesService with WebHookPullRequestReviewCommentService with RequestCache

View File

@@ -1,9 +1,9 @@
package gitbucket.core.ssh package gitbucket.core.ssh
import org.apache.sshd.server.shell.UnknownCommand import org.apache.sshd.server.shell.UnknownCommand
import org.scalatest.FunSpec import org.scalatest.funspec.AnyFunSpec
class GitCommandFactorySpec extends FunSpec { class GitCommandFactorySpec extends AnyFunSpec {
val factory = new GitCommandFactory("http://localhost:8080", None) val factory = new GitCommandFactory("http://localhost:8080", None)

View File

@@ -1,8 +1,8 @@
package gitbucket.core.util package gitbucket.core.util
import org.scalatest.FunSpec import org.scalatest.funspec.AnyFunSpec
class DirectorySpec extends FunSpec { class DirectorySpec extends AnyFunSpec {
describe("GitBucketHome") { describe("GitBucketHome") {
it("should set under target in test scope") { it("should set under target in test scope") {

View File

@@ -1,9 +1,9 @@
package gitbucket.core.util package gitbucket.core.util
import org.scalatest.FunSuite import org.scalatest.funsuite.AnyFunSuite
import GitSpecUtil._ import GitSpecUtil._
class EditorConfigUtilSpec extends FunSuite { class EditorConfigUtilSpec extends AnyFunSuite {
val simpleConfig = val simpleConfig =
"""[*.txt] """[*.txt]
|indent_style = tab |indent_style = tab

View File

@@ -1,8 +1,8 @@
package gitbucket.core.util package gitbucket.core.util
import org.scalatest.FunSuite import org.scalatest.funsuite.AnyFunSuite
class HttpClientUtilSpec extends FunSuite { class HttpClientUtilSpec extends AnyFunSuite {
test("isPrivateAddress") { test("isPrivateAddress") {
assert(HttpClientUtil.isPrivateAddress("localhost") == true) assert(HttpClientUtil.isPrivateAddress("localhost") == true)

View File

@@ -4,11 +4,11 @@ import GitSpecUtil._
import org.apache.commons.io.IOUtils import org.apache.commons.io.IOUtils
import org.eclipse.jgit.diff.DiffEntry.ChangeType import org.eclipse.jgit.diff.DiffEntry.ChangeType
import org.eclipse.jgit.lib.Constants import org.eclipse.jgit.lib.Constants
import org.scalatest.FunSuite import org.scalatest.funsuite.AnyFunSuite
import scala.jdk.CollectionConverters._ import scala.jdk.CollectionConverters._
class JGitUtilSpec extends FunSuite { class JGitUtilSpec extends AnyFunSuite {
test("isEmpty") { test("isEmpty") {
withTestRepository { git => withTestRepository { git =>

View File

@@ -1,8 +1,8 @@
package gitbucket.core.util package gitbucket.core.util
import org.scalatest.FunSpec import org.scalatest.funspec.AnyFunSpec
class StringUtilSpec extends FunSpec { class StringUtilSpec extends AnyFunSpec {
describe("urlEncode") { describe("urlEncode") {
it("should encode whitespace to %20") { it("should encode whitespace to %20") {

View File

@@ -1,9 +1,9 @@
package gitbucket.core.util package gitbucket.core.util
import org.scalatra.i18n.Messages import org.scalatra.i18n.Messages
import org.scalatest.FunSpec import org.scalatest.funspec.AnyFunSpec
class ValidationsSpec extends FunSpec with Validations { class ValidationsSpec extends AnyFunSpec with Validations {
describe("identifier") { describe("identifier") {
it("should validate id string ") { it("should validate id string ") {

View File

@@ -9,14 +9,13 @@ import gitbucket.core.model.Account
import gitbucket.core.service.RequestCache import gitbucket.core.service.RequestCache
import gitbucket.core.service.SystemSettingsService.{RepositoryOperation, Ssh, SystemSettings, Upload, WebHook} import gitbucket.core.service.SystemSettingsService.{RepositoryOperation, Ssh, SystemSettings, Upload, WebHook}
import org.mockito.Mockito._ import org.mockito.Mockito._
import org.scalatest.FunSpec import org.scalatest.funspec.AnyFunSpec
import org.scalatestplus.mockito.MockitoSugar
import play.twirl.api.Html import play.twirl.api.Html
class AvatarImageProviderSpec extends FunSpec with MockitoSugar { class AvatarImageProviderSpec extends AnyFunSpec {
val request = mock[HttpServletRequest] val request = mock(classOf[HttpServletRequest])
val session = mock[HttpSession] val session = mock(classOf[HttpSession])
when(request.getRequestURL).thenReturn(new StringBuffer("http://localhost:8080/path.html")) when(request.getRequestURL).thenReturn(new StringBuffer("http://localhost:8080/path.html"))
when(request.getRequestURI).thenReturn("/path.html") when(request.getRequestURI).thenReturn("/path.html")
when(request.getContextPath).thenReturn("") when(request.getContextPath).thenReturn("")

View File

@@ -2,15 +2,15 @@ package gitbucket.core.view
import gitbucket.core.controller.Context import gitbucket.core.controller.Context
import gitbucket.core.service.RepositoryService.RepositoryInfo import gitbucket.core.service.RepositoryService.RepositoryInfo
import org.scalatest.FunSpec import org.scalatest.funspec.AnyFunSpec
import org.scalatestplus.mockito.MockitoSugar
import java.util.Date import java.util.Date
import java.util.TimeZone import java.util.TimeZone
import org.mockito.Mockito._
class HelpersSpec extends FunSpec with MockitoSugar { class HelpersSpec extends AnyFunSpec {
private implicit val context = mock[Context] private implicit val context = mock(classOf[Context])
private val repository = mock[RepositoryInfo] private val repository = mock(classOf[RepositoryInfo])
import helpers._ import helpers._

View File

@@ -2,11 +2,10 @@ package gitbucket.core.view
import gitbucket.core.controller.Context import gitbucket.core.controller.Context
import gitbucket.core.service.RepositoryService.RepositoryInfo import gitbucket.core.service.RepositoryService.RepositoryInfo
import org.scalatest.FunSpec import org.scalatest.funspec.AnyFunSpec
import org.scalatestplus.mockito.MockitoSugar
import org.mockito.Mockito._ import org.mockito.Mockito._
class MarkdownSpec extends FunSpec with MockitoSugar { class MarkdownSpec extends AnyFunSpec {
import Markdown._ import Markdown._
@@ -96,8 +95,8 @@ tasks
describe("toHtml") { describe("toHtml") {
it("should fix url at the repository root") { it("should fix url at the repository root") {
val repository = mock[RepositoryInfo] val repository = mock(classOf[RepositoryInfo])
val context = mock[Context] val context = mock(classOf[Context])
when(context.currentPath).thenReturn("/user/repo") when(context.currentPath).thenReturn("/user/repo")
when(repository.httpUrl(context)).thenReturn("http://localhost:8080/git/user/repo.git") when(repository.httpUrl(context)).thenReturn("http://localhost:8080/git/user/repo.git")
@@ -117,8 +116,8 @@ tasks
} }
it("should fix sub directory url at the file list") { it("should fix sub directory url at the file list") {
val repository = mock[RepositoryInfo] val repository = mock(classOf[RepositoryInfo])
val context = mock[Context] val context = mock(classOf[Context])
when(context.currentPath).thenReturn("/user/repo/tree/master/sub/dir") when(context.currentPath).thenReturn("/user/repo/tree/master/sub/dir")
when(repository.httpUrl(context)).thenReturn("http://localhost:8080/git/user/repo.git") when(repository.httpUrl(context)).thenReturn("http://localhost:8080/git/user/repo.git")
@@ -138,8 +137,8 @@ tasks
} }
it("should fix sub directory url at the blob view") { it("should fix sub directory url at the blob view") {
val repository = mock[RepositoryInfo] val repository = mock(classOf[RepositoryInfo])
val context = mock[Context] val context = mock(classOf[Context])
when(context.currentPath).thenReturn("/user/repo/blob/master/sub/dir/README.md") when(context.currentPath).thenReturn("/user/repo/blob/master/sub/dir/README.md")
when(repository.httpUrl(context)).thenReturn("http://localhost:8080/git/user/repo.git") when(repository.httpUrl(context)).thenReturn("http://localhost:8080/git/user/repo.git")

View File

@@ -2,9 +2,9 @@ package gitbucket.core.view
import gitbucket.core.util.SyntaxSugars import gitbucket.core.util.SyntaxSugars
import SyntaxSugars._ import SyntaxSugars._
import org.scalatest.FunSpec import org.scalatest.funspec.AnyFunSpec
class PaginationSpec extends FunSpec { class PaginationSpec extends AnyFunSpec {
describe("max") { describe("max") {
it("should return max page number") { it("should return max page number") {