Skip to content

Commit

Permalink
Backport Scalatest upgrade from 2.11 branch to minimize delta.
Browse files Browse the repository at this point in the history
  • Loading branch information
rossabaker committed Apr 19, 2014
1 parent 253603c commit 67bbbdd
Show file tree
Hide file tree
Showing 18 changed files with 32 additions and 26 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<scala-version-suffix>2.10</scala-version-suffix>

<scalatest-artifact>scalatest_${scala-version-suffix}</scalatest-artifact>
<scalatest-version>1.9.2-SNAP1</scalatest-version>
<scalatest-version>2.1.3</scalatest-version>

<sbt-version>0.7.3</sbt-version>
<scalamd.groupId>org.fusesource.scalamd</scalamd.groupId>
Expand Down
2 changes: 1 addition & 1 deletion samples/scalate-sample-scuery/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@

<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-beta-1</version>
<version>${war-plugin-version}</version>
<configuration>
<attachClasses>true</attachClasses>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package org.fusesource.scalate.sample

import _root_.org.junit.runner.RunWith
import _root_.org.scalatest.junit.JUnitRunner
import _root_.org.scalatest.{FunSuite}
import org.scalatest.{ConfigMap, FunSuite}

import _root_.org.fusesource.scalate.test._

Expand All @@ -29,7 +29,7 @@ import _root_.org.fusesource.scalate.test._
@RunWith(classOf[JUnitRunner])
class SampleTest extends FunSuite with WebServerMixin with WebDriverMixin {

override protected def beforeAll(configMap: Map[String, Any]) = {
override protected def beforeAll(configMap: ConfigMap) = {
System.setProperty("scalate.mode", "development")
super.beforeAll(configMap)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.fusesource.scalate.osgi

import java.io.{InputStream, IOException, File}
import scala.tools.nsc.io.AbstractFile
import scala.reflect.io.AbstractFile
import java.net.URL
import java.lang.String
import org.osgi.framework.{ServiceReference, Bundle}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package org.fusesource.scalate

import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import org.scalatest.{BeforeAndAfterAll, FunSuite}
import org.scalatest.{ConfigMap, BeforeAndAfterAll, FunSuite}
import java.io.File
import java.lang.String
import collection.immutable.Map
Expand All @@ -42,7 +42,7 @@ abstract class FunSuiteSupport extends FunSuite with Log with BeforeAndAfterAll
def baseDir = new File(_basedir)


override protected def beforeAll(map: Map[String, Any]): Unit = {
override protected def beforeAll(map: ConfigMap): Unit = {
_basedir = map.get("basedir") match {
case Some(basedir) => basedir.toString
case _ => System.getProperty("basedir", ".")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package org.fusesource.scalate
import java.lang.String
import collection.immutable.Map
import java.io.File
import org.scalatest.ConfigMap

class InjectAttributeTest extends TemplateTestSupport {
test("Using render context directly") {
Expand All @@ -46,7 +47,7 @@ class InjectAttributeTest extends TemplateTestSupport {

def context = new DefaultRenderContext("dummy.ssp", engine)

override protected def beforeAll(configMap: Map[String, Any]) = {
override protected def beforeAll(configMap: ConfigMap) = {
super.beforeAll(configMap)
engine.sourceDirectories = List(new File(baseDir, "src/test/resources"))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package org.fusesource.scalate

import collection.immutable.Map
import java.io.File
import org.scalatest.ConfigMap

class TemplateEngineHelpersTest extends TemplateTestSupport {

Expand All @@ -32,7 +33,7 @@ class TemplateEngineHelpersTest extends TemplateTestSupport {

def context = new DefaultRenderContext("/foo", engine)

override protected def beforeAll(configMap: Map[String, Any]) = {
override protected def beforeAll(configMap: ConfigMap) = {
super.beforeAll(configMap)

engine.sourceDirectories = List(new File(baseDir, "src/test/resources"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ import java.lang.String
import collection.immutable.Map
import util.{Log, IOUtil}
import org.slf4j.LoggerFactory
import org.scalatest.ConfigMap

abstract class TemplateTestSupport extends FunSuiteSupport with Log {

var showOutput = false
var engine: TemplateEngine = _

override protected def beforeAll(configMap: Map[String, Any]) = {
override protected def beforeAll(configMap: ConfigMap) = {
super.beforeAll(configMap)

engine = createTemplateEngine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package rest
import collection.immutable.Map
import java.io.File
import support.DefaultTemplatePackage
import org.scalatest.ConfigMap

class DefaultTemplatePackageTest extends TemplateTestSupport {

Expand All @@ -30,7 +31,7 @@ class DefaultTemplatePackageTest extends TemplateTestSupport {
"name: James town: Mells")
}

override protected def beforeAll(configMap: Map[String, Any]) = {
override protected def beforeAll(configMap: ConfigMap) = {
super.beforeAll(configMap)
engine.sourceDirectories = List(new File(baseDir, "src/test/resources"))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package org.fusesource.scalate.test

import _root_.org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import org.scalatest.{BeforeAndAfterAll, FunSuite}
import org.scalatest.{ConfigMap, BeforeAndAfterAll, FunSuite}
import java.io.File
import java.lang.String
import collection.immutable.Map
Expand All @@ -37,7 +37,7 @@ abstract class FunSuiteSupport extends FunSuite with BeforeAndAfterAll with Log
*/
def baseDir = new File(Config.baseDir)

override protected def beforeAll(map: Map[String, Any]): Unit = {
override protected def beforeAll(map: ConfigMap): Unit = {
map.get("basedir") match {
case Some(basedir) => Config.baseDir = basedir.toString
case _ =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package test

import java.io.File
import util.IOUtil
import org.scalatest.ConfigMap

/**
* A useful base class for testing templates
Expand All @@ -28,7 +29,7 @@ class TemplateTestSupport extends FunSuiteSupport {
var engine: TemplateEngine = _
var showOutput = false

override protected def beforeAll(configMap: Map[String, Any]) = {
override protected def beforeAll(configMap: ConfigMap) = {
super.beforeAll(configMap)

engine = createTemplateEngine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package org.fusesource.scalate.test
import org.openqa.selenium.htmlunit.HtmlUnitDriver
import java.lang.String
import collection.immutable.Map
import org.scalatest.{FunSuite, BeforeAndAfterAll}
import org.scalatest.{ConfigMap, FunSuite, BeforeAndAfterAll}
import org.openqa.selenium.{WebDriver, WebElement}
import org.openqa.selenium.internal.FindsByXPath

Expand All @@ -38,7 +38,7 @@ trait WebDriverMixin extends BeforeAndAfterAll {

def xpathDriver = webDriver.asInstanceOf[FindsByXPath]

override protected def afterAll(configMap: Map[String, Any]) = webDriver.close
override protected def afterAll(configMap: ConfigMap) = webDriver.close

/*
def pageContains(text: String): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
package org.fusesource.scalate.test

import org.scalatest.{Suite, BeforeAndAfterAll}
import org.scalatest.{ConfigMap, Suite, BeforeAndAfterAll}


/**
Expand All @@ -30,7 +30,7 @@ trait WebServerMixin extends BeforeAndAfterAll {

val webServer = new JettyServer

override protected def beforeAll(configMap: Map[String, Any]): Unit = {
override protected def beforeAll(configMap: ConfigMap): Unit = {
configMap.get("basedir") match {
case Some(basedir) => val text = basedir.toString
println("Setting basedir to: " + text)
Expand All @@ -43,7 +43,7 @@ trait WebServerMixin extends BeforeAndAfterAll {
webServer.start
}

override protected def afterAll(configMap: Map[String, Any]) = webServer.stop
override protected def afterAll(configMap: ConfigMap) = webServer.stop

def rootUrl = webServer.rootUrl
}
1 change: 0 additions & 1 deletion scalate-util/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
<version>${scala-version}</version>
</dependency>


<!-- testing -->
<dependency>
<groupId>org.scalatest</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import xml.NodeSeq

import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import org.scalatest.{BeforeAndAfterAll, FunSuite}
import org.scalatest.{ConfigMap, BeforeAndAfterAll, FunSuite}
import org.slf4j.LoggerFactory

/**
Expand All @@ -40,7 +40,7 @@ abstract class FunSuiteSupport extends FunSuite with Log with BeforeAndAfterAll
def baseDir = new File(_basedir)


override protected def beforeAll(map: Map[String, Any]): Unit = {
override protected def beforeAll(map: ConfigMap): Unit = {
_basedir = map.get("basedir") match {
case Some(basedir) => basedir.toString
case _ => System.getProperty("basedir", ".")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package org.fusesource.scalate.console

import _root_.org.junit.runner.RunWith
import _root_.org.scalatest.junit.JUnitRunner
import _root_.org.scalatest.{FunSuite}
import org.scalatest.{ConfigMap, FunSuite}

import _root_.org.fusesource.scalate.test._
import java.lang.String
Expand Down Expand Up @@ -56,7 +56,7 @@ class ConsoleTest extends FunSuite with WebServerMixin with WebDriverMixin {
}


override protected def beforeAll(configMap: Map[String, Any]) = {
override protected def beforeAll(configMap: ConfigMap) = {
System.setProperty("scalate.mode", "development")
super.beforeAll(configMap)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package org.fusesource.scalate.wikitext

import org.fusesource.scalate.test.TemplateTestSupport
import java.io.File
import org.scalatest.ConfigMap

class ChildrenTest extends TemplateTestSupport {

Expand All @@ -40,7 +41,7 @@ class ChildrenTest extends TemplateTestSupport {
}


override protected def beforeAll(map: Map[String, Any]) = {
override protected def beforeAll(map: ConfigMap) = {
super.beforeAll(map)

engine.sourceDirectories = List(new File(baseDir, "src/test/resources"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ package org.fusesource.scalate.wikitext

import org.fusesource.scalate.test.TemplateTestSupport
import java.io.File
import org.scalatest.ConfigMap

class IncludeTest extends TemplateTestSupport {

test("include") {
assertUriOutputContains("include/test.conf", "Testing include", "Included1", "Included2")
}

override protected def beforeAll(map: Map[String, Any]) = {
override protected def beforeAll(map: ConfigMap) = {
super.beforeAll(map)

engine.sourceDirectories = List(new File(baseDir, "src/test/resources"))
Expand Down

0 comments on commit 67bbbdd

Please sign in to comment.