From ba75a8c12d38bbe9b875634f405c789463307e53 Mon Sep 17 00:00:00 2001 From: Jesse Eichar Date: Fri, 21 Sep 2012 16:17:19 +0200 Subject: [PATCH] minor fixes for tests --- core/src/main/scala/c2c/webspecs/ExecutionContext.scala | 5 +++-- .../geonetwork/geocat/spec/WP1/ImportCheMetadataSpec.scala | 4 ++-- .../webspecs/geonetwork/geocat/spec/WP12/GM03v1Spec.scala | 2 +- .../webspecs/geonetwork/geocat/spec/WP12/GM03v2Spec.scala | 2 +- .../geonetwork/geocat/spec/WP16/MonitoringSpec.scala | 2 +- .../geocat/src/test/scala/c2c/webspecs/suite/AllSpecs.scala | 6 +++--- project/Build.scala | 2 +- sbt | 2 +- 8 files changed, 13 insertions(+), 12 deletions(-) diff --git a/core/src/main/scala/c2c/webspecs/ExecutionContext.scala b/core/src/main/scala/c2c/webspecs/ExecutionContext.scala index b60f627..5f751c1 100644 --- a/core/src/main/scala/c2c/webspecs/ExecutionContext.scala +++ b/core/src/main/scala/c2c/webspecs/ExecutionContext.scala @@ -19,7 +19,7 @@ object ExecutionContext { def apply[R](context:ExecutionContext)(f : ExecutionContext => R):R = { try {f(context)} finally { - context.httpClient.getConnectionManager.shutdown + context.close } } def withDefault[R] (f : ExecutionContext => R):R = @@ -36,7 +36,8 @@ trait ExecutionContext { def createHttpContext:() => HttpContext val conn: ClientConnectionManager = httpClient.getConnectionManager var modifications:List[RequestModification] = Nil - def close() = httpClient.getConnectionManager.shutdown + def close() = + httpClient.getConnectionManager.shutdown def execute(request:HttpRequestBase) = request match { case r:LoginRequest if currentUser.exists {_._1.user == r.user} => Log.apply(Log.Connection, "Skipping login request since user is already logged in") diff --git a/geonetwork/geocat/src/test/scala/c2c/webspecs/geonetwork/geocat/spec/WP1/ImportCheMetadataSpec.scala b/geonetwork/geocat/src/test/scala/c2c/webspecs/geonetwork/geocat/spec/WP1/ImportCheMetadataSpec.scala index ac0b068..998132c 100644 --- a/geonetwork/geocat/src/test/scala/c2c/webspecs/geonetwork/geocat/spec/WP1/ImportCheMetadataSpec.scala +++ b/geonetwork/geocat/src/test/scala/c2c/webspecs/geonetwork/geocat/spec/WP1/ImportCheMetadataSpec.scala @@ -10,8 +10,8 @@ import org.junit.runner.RunWith import org.specs2.runner.JUnitRunner @RunWith(classOf[JUnitRunner]) -class ImportCheMetadataSpec extends GeocatSpecification { def is = - +class ImportCheMetadataSpec extends GeocatSpecification { def is = + "This specification tests using the iso19139.CHE schema" ^ Step(setup) ^ "Inserting a CHE metadata" ^ Step(importAndGetMetadata) ^ "Should suceed with a 200 response" ! {importAndGetMetadata must haveA200ResponseCode} ^ diff --git a/geonetwork/geocat/src/test/scala/c2c/webspecs/geonetwork/geocat/spec/WP12/GM03v1Spec.scala b/geonetwork/geocat/src/test/scala/c2c/webspecs/geonetwork/geocat/spec/WP12/GM03v1Spec.scala index 84addf9..daef67e 100644 --- a/geonetwork/geocat/src/test/scala/c2c/webspecs/geonetwork/geocat/spec/WP12/GM03v1Spec.scala +++ b/geonetwork/geocat/src/test/scala/c2c/webspecs/geonetwork/geocat/spec/WP12/GM03v1Spec.scala @@ -16,7 +16,7 @@ import c2c.webspecs.geonetwork.GetRawMetadataXml @RunWith(classOf[JUnitRunner]) class GM03V1Spec extends GeocatSpecification(UserProfiles.Editor) { def is = { - "GM03v1 Import / Export test".title ^ Step(setup) ^ + "GM03v1 Import - Export test".title ^ Step(setup) ^ "Imports a GM03 v1 metadata and converts it into iso19139.che for storage into the catalogue" ^ Step(importMetadataId) ^ "Gets the previously inserted MD as GM03v2" ! getAsGm03v2 ^ "Gets the previously inserted MD as GM03v2small" ! getAsGm03v2small ^ diff --git a/geonetwork/geocat/src/test/scala/c2c/webspecs/geonetwork/geocat/spec/WP12/GM03v2Spec.scala b/geonetwork/geocat/src/test/scala/c2c/webspecs/geonetwork/geocat/spec/WP12/GM03v2Spec.scala index eb10c9f..206b71f 100644 --- a/geonetwork/geocat/src/test/scala/c2c/webspecs/geonetwork/geocat/spec/WP12/GM03v2Spec.scala +++ b/geonetwork/geocat/src/test/scala/c2c/webspecs/geonetwork/geocat/spec/WP12/GM03v2Spec.scala @@ -15,7 +15,7 @@ import c2c.webspecs.GetRequest @RunWith(classOf[JUnitRunner]) class GM03V2Spec extends GeocatSpecification(UserProfiles.Editor) { def is = { - "GM03v2 Import / Export test".title ^ Step(setup) ^ + "GM03v2 Import - Export test".title ^ Step(setup) ^ "Imports a GM03 v2 metadata and converts it into iso19139.che for storage into the catalogue" ^ Step(importMetadataId) ^ "Gets the previously inserted MD as GM03v2" ! getAsGm03v2 ^ "Gets the previously inserted MD as GM03v2Small" ! getAsGm03v2small ^ diff --git a/geonetwork/geocat/src/test/scala/c2c/webspecs/geonetwork/geocat/spec/WP16/MonitoringSpec.scala b/geonetwork/geocat/src/test/scala/c2c/webspecs/geonetwork/geocat/spec/WP16/MonitoringSpec.scala index 5d4207d..3dab448 100644 --- a/geonetwork/geocat/src/test/scala/c2c/webspecs/geonetwork/geocat/spec/WP16/MonitoringSpec.scala +++ b/geonetwork/geocat/src/test/scala/c2c/webspecs/geonetwork/geocat/spec/WP16/MonitoringSpec.scala @@ -15,7 +15,7 @@ import c2c.webspecs.geonetwork.UserProfiles */ @RunWith(classOf[JUnitRunner]) class MonitoringSpec extends GeocatSpecification(UserProfiles.Admin) { def is = - "Xsl custom metadata XML output".title ^ Step(setup) ^ + "Monioring Specification".title ^ Step(setup) ^ "Add some metadata so that healthchecks will work" ^ Step(importMd) ^ "Get the results of the ${metrics} webservice" ! checkMonitorReport ^ "Get the results of the ${healthcheck} webservice" ! checkMonitorReport ^ diff --git a/geonetwork/geocat/src/test/scala/c2c/webspecs/suite/AllSpecs.scala b/geonetwork/geocat/src/test/scala/c2c/webspecs/suite/AllSpecs.scala index c840373..0884ad3 100644 --- a/geonetwork/geocat/src/test/scala/c2c/webspecs/suite/AllSpecs.scala +++ b/geonetwork/geocat/src/test/scala/c2c/webspecs/suite/AllSpecs.scala @@ -70,7 +70,7 @@ class WP1 extends Specification with SpecificationsFinder { def is = classOf[ImportValidationSpec] ).flatMap{s => createSpecification(s.getName)(Arguments())} specs. - foldLeft(t.title) { (res, cur) => res ^ link(cur) } + foldLeft(t.title ^ sequential) { (res, cur) => res ^ link(cur) } } } @@ -84,7 +84,7 @@ class WP2 extends Specification with SpecificationsFinder { def is = classOf[CompareGeocat1Metadata] ).flatMap{s => createSpecification(s.getName)(Arguments())} specs. - foldLeft(t.title) { (res, cur) => res ^ link(cur) } + foldLeft(t.title ^ sequential) { (res, cur) => res ^ link(cur) } } } @@ -217,7 +217,7 @@ class WP10 extends Specification with SpecificationsFinder { def is = @RunWith(classOf[JUnitRunner]) class WP11_12 extends Specification with SpecificationsFinder { def is = -examplesLinks("WP 11/12: GM03 Import and Export") +examplesLinks("WP 11,12: GM03 Import and Export") def examplesLinks(t: String) = { val specs = List( diff --git a/project/Build.scala b/project/Build.scala index 731715d..59ef273 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -47,7 +47,7 @@ object WebSpecsBuild extends Build // ------------------------------ Core Project ------------------------------ // val coreDependencies = Seq( - "org.specs2" %% "specs2" % "1.12", + "org.specs2" %% "specs2" % "1.12.1", "org.ccil.cowan.tagsoup" % "tagsoup" % "1.2", "org.apache.httpcomponents" % "httpclient" % "4.1.2", "org.apache.httpcomponents" % "httpmime" % "4.1.2", diff --git a/sbt b/sbt index 4d78a53..2ec6386 100755 --- a/sbt +++ b/sbt @@ -1,5 +1,5 @@ #!/bin/sh SBT_OPTS="$SBT_OPTS -Dfile.encoding=UTF8 -Xmx1536M -Xss10M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m" #SBT_OPTS="$SBT_OPTS -Dadmin.user=admin -Dadmin.pass=Hup9ieBe -Dwebspecs.config=/Users/jeichar/ScalaProject/webspecs/geonetwork/geocat/src/test/resources/geocat/jesse_geocat_config.properties" -SBT_OPTS="$SBT_OPTS -Dadmin.user=admin -Dadmin.pass=admin -Dtest.server=localhost:9624" +SBT_OPTS="$SBT_OPTS -Dadmin.user=admin -Dadmin.pass=admin -Dtest.server=localhost:8190" exec java ${SBT_OPTS} -jar ./sbt-launch.jar "$@"